https://github.com/cpredef/predef Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} cpredef / predef Public * Notifications * Fork 12 * Star 172 Pre-defined Compiler Macros wiki License CC-BY-4.0 license 172 stars 12 forks Star Notifications * Code * Issues 4 * Pull requests 0 * Actions * Security * Insights More * Code * Issues * Pull requests * Actions * Security * Insights cpredef/predef This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 5 branches 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/c] Use Git or checkout with SVN using the web URL. [gh repo clone cprede] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @xavery @a1batross xavery and a1batross OperatingSystems: fix broken VxWorks table ... d3b191f Oct 18, 2022 OperatingSystems: fix broken VxWorks table d3b191f Git stats * 34 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time Architectures.md Architectures: add NEC SX-Aurora TSUBASA Oct 13, 2022 Compilers.md Compilers: Add Microsoft Visual C++ 17.x to version table Jul 25, 2022 DataModels.md Initial import from original Predefined Macros wiki Jul 31, 2021 Endianness.md Endianness.md: Fix formatting Sep 5, 2022 FeatureMacros.md Fix codeblocks Jul 31, 2021 LICENSE license: add CC-BY 4.0 Jul 19, 2022 Libraries.md Clarify that wiki fork accepts patches through pull requests Aug 5, 2021 OperatingSystems.md OperatingSystems: fix broken VxWorks table Oct 18, 2022 README.md Clarify that wiki fork accepts patches through pull requests Aug 5, 2021 Standards.md Clarify that wiki fork accepts patches through pull requests Aug 5, 2021 VersionNormalization.md Fix codeblocks Jul 31, 2021 View code Pre-defined C/C++ Compiler Macros Introduction Contributors README.md Pre-defined C/C++ Compiler Macros The macros are found here: * Standards * Compilers * Libraries * Operating systems * Architectures General guidelines are found here: * Version normalization * Feature macros * Endianness Please send updates/corrections to predef-contribute or through pull requests on GitHub. Introduction C and C++ compilers automatically define certain macros that can be used to check for compiler or operating system features. This is useful when writing portable software. These pages lists various pre-defined compiler macros that can be used to identify standards, compilers, operating systems, hardware architectures, and even basic run-time libraries at compile-time. For example, if we want to use a generic or opaque pointer type, we use void pointers. However, ancient K&R compilers (from the time before the first ANSI C standard) do not support void pointers. Instead we can define our own type: #if defined(__STDC__) || defined(__cplusplus) || defined(_MSC_EXTENSIONS) typedef void * t_pointer; #else typedef char * t_pointer; #endif Another example, Microsoft Visual C++ version 4.2 added a pragma to reduce compilation times by only including a file once (if _MSC_VER is not defined then it will evaluate to 0 (zero) -- however, some compilers may complain about an undefined macro) #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif The macros contained in these pages have been obtained through vendor documentation, the defines script, contributors, and third-party source code. No guarantee about the correctness of the macros is given. An often-used alternative is Autoconf, which is a more powerful tool to examine various types of features, including compilation options. However, Autoconf is fairly Unix-centric, and requires a Unix layer on other platforms (e.g. Cygwin on Windows). Other alternatives are Buildtool, CMake, SCons, PMK, Jam, Ant, and Bakefile. Contributors Bjorn Reese, Daniel Stenberg, Greg Roelofs, Steven G. Johnson, Wlodzimierz ABX Skiba, Marc Finet, Philip Newton, Mitchell Charity, Christian Klutz, Seo Sanghyeon, Chris Adami, Geoff Clare, Dan Fandrich, Mike Gorchak, Yuri D'Elia, Gynvael Coldwind, Alain Tauch, Vadim Zeitlin, Steve White, Thomas David Rivers, Tom Honermann, Martin Mitas, Dinesh Chhadwa, Erik Faye-Lund, Leo Davis, Paul Hsieh, Roland Schwarz, Darko Kolakovic, Andy Buonviri, Ming Kin Lai, Kent Johnson, Helmut Bauer, Oliver Schneider, Ron Pimblett, Jose Luis Rodriguez Garcia, Jeroen Ruigrok van der Werven, Uffe Jakobsen, Bryan Ashby, Bruno Haible, Artur Bac, Terry Schwarz, Leo Davis, Markus Duft, William Dang, Paul Green, Ruben Van Boxem, Pau Garcia i Quiles, Mikulas Patocka, Leo Davis, Mark Ferry, Holger Machens, Simon Watts, Paul Hargrove, Hans-Christoph Steiner, Gerald Combs, Denys Bulant, Massimo Morara, Jeremy Bennett, Guillem Jover, Riku Voipio, Jacques Pelletier, Mark Jarvin, Georg Sauthoff, Scot Jenkins, Grzegorz Brzeczyszczykiewicz, John Dallman, Gianmichele Toglia, Robbie Groenewoudt, Andreas Mohr, Aleksei Piuretskii, Sverre Hvammen Johansen, Stefan Tauner, Daniel Garcia, Ozkan Sezer, Dean Saridakis, Frank Long, Kevin Adler. About Pre-defined Compiler Macros wiki Topics c documentation portability ifdef Resources Readme License CC-BY-4.0 license Stars 172 stars Watchers 9 watching Forks 12 forks Contributors 7 * @a1batross * @mmuman * @breese * @jay * @amitdo * @xavery * @jclulow Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.