Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Comments on Is `-isystem` a POSIX cc option?

Post

Is `-isystem` a POSIX cc option?

+3
−0

Is -isystem/path/to/sys/includes a standard compiler option, or is it a compiler extension implemented by gcc, clang, and maybe other compilers? Can I rely on its availability?

I couldn't find the POSIX specification for cc(1).

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

No, you cannot rely on its availability... (3 comments)
No, you cannot rely on its availability...
elgonzo‭ wrote over 2 years ago · edited over 2 years ago

I couldn't find the POSIX specification for cc(1).

No surprise, because cc is not part of the POSIX-defined utilities. c99 is. (with respect to the latest POSIX 1003.1-2017 standard)

Aside from that, without specifying which C/C++ (i assume) compiler(s) and which compiler versions your Q is about, one has to assume your question is about any C/C++ compiler. The probability that all C/C++ compilers in all (recent-ish) versions made available to the public (or to be made available in the future) feature the -isystem option exhibiting the expected/desired behavior is approaching zero. (And you would only need to find one single compiler not having an -isystem option or having one with a diverging behavior for the probability to become a perfect zero). On the other hand, if your Q is meant to ask about some specific compilers only, you could quite easily and very quickly determine whether the compilers of interest have such an option by simply looking up their documentation/man pages

alx‭ wrote over 2 years ago

Hmm, interesting. I'll copy here a link to the c99(1) specification for completeness: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html.

My question was about portability to Unix systems, including systems about which I don't know much, such as Solaris or HPUX for example. If a weird Windows compiler doesn't like the option, okay, but if a Unix compiler doesn't, that would be a problem for me.

elgonzo‭ wrote over 2 years ago · edited over 2 years ago

[...] but if a Unix compiler doesn't, that would be a problem for me.

Well, you already linked the POSIX standard for c99. Does it feature an -isystem option? And if c99 is not required by the POSIX standard to have an -isystem option, would it be a problem for you if some POSIX-compliant c99 on some Unix-like platform does not implement -isystem? If so, you need to stick with the compilers that support this option. Don't worry about unknowns. Instead, make it an explicit requirement which compiler(s) shall/can be used to build your project(s). (like -almost- everybody else is doing...)