• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: GCC not doing the correct thing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GCC not doing the correct thing?


  • Subject: Re: GCC not doing the correct thing?
  • From: "Clark S. Cox III" <email@hidden>
  • Date: Mon, 11 Nov 2002 09:46:31 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Monday, Nov 11, 2002, at 07:21 US/Eastern, Thomas Castiglione wrote:

I couldn't agree more. The GOOD news is that that code works perfectly in GCC, for me at least. Simple test case, using your example:


#define CUBE(A) ((A) * (A) * (A))
main() {
char *a = "ABCD";
printf("%s\n", a);
cube(*a++);
printf("%s\n", a);
}

I promise you, you are asking for trouble. There is no guarantee that this behavior will not change (i.e. in a new compiler version, on a new processor, etc.), because this behavior is undefined according to the C standard (i.e. the compiler is free to do ANYTHING). You are making unwarranted assumptions about the language; yes, they are logical assumptions, and it "feels" right that this should work, but it doesn't.

- -- http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)

iEYEARECAAYFAj3PwswACgkQd6STocYT1xU9+QCdGsPqqWgnU6PLfrewtRG9Rfyr
zacAmgJkF1uVWA7K4JeTPUkYHpxKH7ru
=YR9C
-----END PGP SIGNATURE-----
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: GCC not doing the correct thing? (From: Thomas Castiglione <email@hidden>)

  • Prev by Date: Re: GCC not doing the correct thing?
  • Next by Date: Re: "weak link" framework refs for 10.1 compatibility?
  • Previous by thread: Re: GCC not doing the correct thing?
  • Next by thread: Re: GCC not doing the correct thing?
  • Index(es):
    • Date
    • Thread