PDA

View Full Version : Platform #defines


Skorche
2005.09.08, 03:24 AM
Does anyone know where there is a table for symbols defined for different platforms? I've had some very inconclusive google runs.

I really just need the ones for OSX, Windows, and Linux.

OneSadCookie
2005.09.08, 03:43 AM
__APPLE__
_WIN32
linux

Skorche
2005.09.08, 09:53 AM
Ah, thank you.

Where would you find out what other kinds of symbols are defined at compile time though? I looked everywhere I could think of and googled everything I could think of and couldn't find anything.

ThemsAllTook
2005.09.08, 12:40 PM
Keith showed me this handy little trick a while ago. Give it a try:

touch foo.h && gcc -v -E -dM foo.h | less

MattDiamond
2005.09.08, 11:45 PM
You might be interested in the POSH (Portable Open Source Header) library, which abstracts very basic platform differences.
http://www.bookofhook.com/poshlib/Overview.html

Portability issues including using POSH are discussed in Brian Hook's new book Writing Portable Code.
http://www.hookatooka.com/wpc/

Disclaimer: these items are on I am hoping to dig into at some point, but I've not read the book nor used the library.

Fenris
2005.09.09, 01:56 AM
...and I'm just touching up the review of the book. ;)