跨平臺開發,各種巨集的定義
gcc跨平臺開發,各種巨集的定義,_WIN32,__linux,__unix
Re: Cross platform code
From: Oleg Goldshmidt (pub_at_nonexisting.hamakor.org.il)
Date: Fri 04 Jul 2003 - 03:09:22 IDT
* Next message: Orna Agmon: "[HAIFUX LECTURE] from python import lecture, by Muli Ben-Yehuda"
* Previous message: Shachar Shemesh: "Re: Cross platform code"
* In reply to: Gilboa Davara: "Re: Cross platform code"
* Next in thread: Gilboa Davara: "Re: Cross platform code"
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
* Mail actions: [ respond to this message ] [ mail a new topic ]
Gilboa Davara <gilboa_at_xml-systems.com> writes:
> CPP/GCC/CC all define _WIN32 by default under all the environment I ever
> worked on. (which is pretty extensive.)
Really? Right now I am in an environment where several different
version of cpp and gcc don‘t define that. It seems to me that the
range of environments where gcc defines _WIN32 is pretty narrow.
To complement that, I have no idea what you mean by CPP or CC.
> By design, compilers running under Windows (be that Watcom, Borland or
> MCVC) must define _WINTVER, _WIN32 and M_IX86/M_ALPA/etc in-order to
> include the Winxxx.h files. (which are required to access any OS
> functions)
That‘s fine, this is exactly one platform that we have covered in the
passage above.
> So yes, these are compiler defined macros that can be relayed upon.
Yes, indeed. However, I know of no rule that says that, e.g., unix must
be defined for any of the unices or for Linux, as the snippet of your
earlier mail that follows below seems to imply.
On my RH7.3 gcc does define unix, __unix, __unix__, linux, __linux,
and __linux__. However, it is enough to use the -ansi option to
make unix and linux disappear. There you go.
None of the standard glibc or glibc-kernel headers (meaning
linux-specific headers exposed to applications programmers) uses unix,
__unix, or __unix__ (some applications do, but it‘s their
business). This tells me that gcc only uses those internally, and not
to access any library or system facilities. This means that there may
be compilers that will not define these macros and still work just
fine.
Gilboa Davara <gilboa_at_xml-systems.com> writes:
> Better yet:
>
> #ifdef unix
>
> // UNIX/Linux/*BSD.
>
> #endif
>
> #ifdef _WIN32
>
> // Window stuff
>
> #endif
>
> Both symbols are auto defined by the compiler.
Re: Cross platform code
From: Oleg Goldshmidt (pub_at_nonexisting.hamakor.org.il)
Date: Fri 04 Jul 2003 - 03:09:22 IDT
* Next message: Orna Agmon: "[HAIFUX LECTURE] from python import lecture, by Muli Ben-Yehuda"
* Previous message: Shachar Shemesh: "Re: Cross platform code"
* In reply to: Gilboa Davara: "Re: Cross platform code"
* Next in thread: Gilboa Davara: "Re: Cross platform code"
* Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
* Mail actions: [ respond to this message ] [ mail a new topic ]
Gilboa Davara <gilboa_at_xml-systems.com> writes:
> CPP/GCC/CC all define _WIN32 by default under all the environment I ever
> worked on. (which is pretty extensive.)
Really? Right now I am in an environment where several different
version of cpp and gcc don‘t define that. It seems to me that the
range of environments where gcc defines _WIN32 is pretty narrow.
To complement that, I have no idea what you mean by CPP or CC.
> By design, compilers running under Windows (be that Watcom, Borland or
> MCVC) must define _WINTVER, _WIN32 and M_IX86/M_ALPA/etc in-order to
> include the Winxxx.h files. (which are required to access any OS
> functions)
That‘s fine, this is exactly one platform that we have covered in the
passage above.
> So yes, these are compiler defined macros that can be relayed upon.
Yes, indeed. However, I know of no rule that says that, e.g., unix must
be defined for any of the unices or for Linux, as the snippet of your
earlier mail that follows below seems to imply.
On my RH7.3 gcc does define unix, __unix, __unix__, linux, __linux,
and __linux__. However, it is enough to use the -ansi option to
make unix and linux disappear. There you go.
None of the standard glibc or glibc-kernel headers (meaning
linux-specific headers exposed to applications programmers) uses unix,
__unix, or __unix__ (some applications do, but it‘s their
business). This tells me that gcc only uses those internally, and not
to access any library or system facilities. This means that there may
be compilers that will not define these macros and still work just
fine.
Gilboa Davara <gilboa_at_xml-systems.com> writes:
> Better yet:
>
> #ifdef unix
>
> // UNIX/Linux/*BSD.
>
> #endif
>
> #ifdef _WIN32
>
> // Window stuff
>
> #endif
>
> Both symbols are auto defined by the compiler.
相關文章
- 聊聊移動端跨平臺開發的各種技術
- ios開發的巨集定義iOS
- 各種SmartPhone上的跨平臺開源框架的總結框架
- iOS-日常開發常用巨集定義iOS
- iOS開發:pch檔案中的巨集定義iOS
- 跨平臺開發框架的大旗框架
- Dart Editor——跨平臺的開發工具Dart
- 跨平臺開發框架 Lynx 初探框架
- QT6跨平臺開發QT
- 使用c++開發跨平臺的程式C++
- 跨平臺開發時代的 (再次) 到來?
- 使用wxdindows開發跨平臺的介面(轉)
- iOS開發技巧:應用巨集定義使用字型iOS
- Swift 裡的巨集定義Swift
- 00-跨平臺開發之FlutterFlutter
- APP跨平臺開發技術分析APP
- 跨平臺開發Flutter初體驗Flutter
- 移動跨平臺開發深度解析
- 跨平臺開發技術簡介!
- hybird跨平臺移動app開發APP
- c++跨平臺開發經驗C++
- 移動端跨平臺開發的深度解析
- iOS常用巨集定義iOS
- 快速開發平臺的幕後意義
- MediaPipe - 跨平臺機器學習應用開發框架API機器學習框架
- 使用 Vagrant 打造跨平臺開發環境開發環境
- 邁步進入跨平臺開發時代
- 移動開發的跨平臺技術演進移動開發
- TypeScript, Angular 和移動端的跨平臺開發TypeScriptAngular
- NODE_ENV跨平臺設定
- C語言(巨集定義)C語言
- C++巨集定義#defineC++
- C#移動跨平臺開發(2)Xamarin移動跨平臺解決方案是如何工作的?C#
- flutter跨平臺開發之App升級方案FlutterAPP
- 小程式跨平臺開發解決方案探索
- 跨平臺 App 開發引擎 CrossApp 亮相 GMGDCAPPROS
- 推薦幾款App跨平臺開發工具APP
- MobileLab跨平臺開發專題交流會