TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C language and the linux keyword - proof that linux is always Number 1

2 pointsby slashdotaccountover 11 years ago

2 comments

hisham_hmover 11 years ago
&quot;linux&quot; is not a keyword in the C language. It&#x27;s a preprocessor macro defined in the header files shipped with Linux systems -- that&#x27;s quite, quite different.<p>It&#x27;s there so you can guard platform-dependent code with #if linux -- that&#x27;s why it&#x27;s defined to a trivial non-zero value.<p>This kind of macro should really be named with underscores, like __linux__ but the bare linux constant has been there since the early days of Linux and they just can&#x27;t remove it now.<p>For fun, here&#x27;s a list of other OS-specific macros for platform detection:<p><a href="http://sourceforge.net/p/predef/wiki/OperatingSystems/" rel="nofollow">http:&#x2F;&#x2F;sourceforge.net&#x2F;p&#x2F;predef&#x2F;wiki&#x2F;OperatingSystems&#x2F;</a>
NAFV_Pover 11 years ago
I cannot think of a single C keyword that returns a value.