LWN.net Logo

Why Linux Is a Model Citizen of Quality Code (Linux.com)

Why Linux Is a Model Citizen of Quality Code (Linux.com)

Posted Feb 25, 2012 3:29 UTC (Sat) by imgx64 (guest, #78590)
In reply to: Why Linux Is a Model Citizen of Quality Code (Linux.com) by robert_s
Parent article: Why Linux Is a Model Citizen of Quality Code (Linux.com)

To be fair, lots of developers can't do multi-threaded programming. But the PHP developers get confused even on trivial things like end of line and indentation. Check this gem:

#ifdef PHP_WIN32
#   include "tsrm_win32.h"
#   include "win95nt.h"
#   ifdef PHP_EXPORTS
#       define PHPAPI __declspec(dllexport)
#   else
#       define PHPAPI __declspec(dllimport)
#   endif
#   define PHP_DIR_SEPARATOR '\\'
#   define PHP_EOL "\r\n"
#else
#   if defined(__GNUC__) && __GNUC__ >= 4
#       define PHPAPI __attribute__ ((visibility("default")))
#   else
#       define PHPAPI
#   endif

#define THREAD_LS
#define PHP_DIR_SEPARATOR '/'
#if defined(__MacOSX__)
#define PHP_EOL "\r"
#else 
#define PHP_EOL "\n"
#endif
#endif


(Log in to post comments)

Why Linux Is a Model Citizen of Quality Code (Linux.com)

Posted Feb 26, 2012 3:32 UTC (Sun) by k8to (subscriber, #15413) [Link]

As a bonus, the choice of newline for os x is wrong.

LOL

Posted Feb 27, 2012 11:42 UTC (Mon) by cortana (subscriber, #24596) [Link]

I guess no one noticed because __MacOSX__ is not defined by any compiler. You're supposed to test for __APPLE__ & __MACH__ to detect Mac OS X.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds