Giter Club home page Giter Club logo

Comments (2)

gperciva avatar gperciva commented on July 22, 2024

Thinking about this a bit more, I'm confused. I view "-D_POSIX_C_SOURCE" as saying "I need to use POSIX features, not just standard C features". But it seems that some people view "-D_POSIX_C_SOURCE" as saying "I promise that I'm not using anything other than POSIX"?

One point towards the "I promise I'm not using anything other than POSIX" is this:

When an application includes a header described by POSIX.1-2008, and when this feature test macro is defined to have the value 200809L:
...
Additional symbols not required or explicitly permitted by POSIX.1-2008 to be in that header shall not be made visible, except when enabled by another feature test macro.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_02_01_01

However, sys/mount.h isn't in POSIX, nor is statfs, so I guess this part of the spec doesn't apply?

I notice that I am confused.

from tarsnap.

cperciva avatar cperciva commented on July 22, 2024

So, _POSIX_C_SOURCE says "I claim that this code is strictly POSIX-compliant; make sure that you don't break it". In many cases this means "don't expose symbols which POSIX doesn't mention", since if (for example) an OS declares a function foobar but the strictly-POSIX-compliant program provides its own foobar, the incompatible declarations could break the build otherwise.

This does not apply in the case of headers which don't exist in POSIX, because if a program is trying to include those then it's lying about being strictly POSIX-compliant and so all guarantees are voided.

One possibility here would be to put #undef _POSIX_C_SOURCE at the top of the C files where we're using non-POSIX functionality; I'd hope that there aren't very many such files, but I'm not sure. Alternatively, compile libcperciva code with _POSIX_C_SOURCE set but omit it for libarchive-derived code?

from tarsnap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.