-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Jim Meyering on 6/14/2008 2:04 AM: | Bruno Haible <[EMAIL PROTECTED]> wrote: | ... |> 1) This C code |> |> const size_t cutoff = 1024; |> char buf[cutoff]; |> |> is understood only by gcc, Tru64 cc, IRIX cc. It fails to compile on other C |> compilers:
Bruno, thanks for the cleanup. |> ! const size_t cutoff = 1024; |> ! char buf[cutoff]; | ... |> --- 58,73 ---- |> ! #define CUTOFF 1024 |> ! char buf[CUTOFF]; | | Why not use an enum, as you suggested above? | | enum { CUTOFF = 1024 }; | char buf[CUTOFF]; | | Then you can copy/paste expressions involving "CUTOFF" into | debuggers that don't know about CPP-defined symbols. | | Besides, code without cpp directives just looks better ;-) | I likewise much prefer the enum-style of code over macros, having used it myself elsewhere. I'm not sure what qualifies as mainstream, but using enum for int constants is certainly not a foreign coding concept. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkhTv5sACgkQ84KuGfSFAYAr+gCeNUrLW1Sg/D+a2oeIYP9YiMya e/YAnAqKgo+jHrH1gY8My1jBA1tOUkX8 =Bhem -----END PGP SIGNATURE-----