Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does #define _POSIX_SOURCE mean?

Tags:

c

posix

macros

What advantages does using #define _POSIX_SOURCE in C confer to my program? Can I access more libraries in my program or I can call some functions which are present directly in C. What is this macro used for?

like image 894
Syed Shaharyaar Hussain Avatar asked Jan 19 '18 00:01

Syed Shaharyaar Hussain


People also ask

What does the fox say Meaning?

Speaking of the meaning of the song, Vegard characterizes it as coming from "a genuine wonder of what the fox says, because we didn't know". Although interpreted by some commentators as a reference to the furry fandom, the brothers have stated they did not know about its existence when producing "The Fox".

What does a real fox say?

One of the most common fox vocalizations is a raspy bark. Scientists believe foxes use this barking sound to identify themselves and communicate with other foxes. Another eerie fox vocalization is a type of high-pitched howl that's almost like a scream.

How can I identify a song by sound?

On your phone, touch and hold the Home button or say "Hey Google." Ask "What's this song?" Play a song or hum, whistle, or sing the melody of a song. Hum, whistle, or sing: Google Assistant will identify potential matches for the song.


1 Answers

It allows you to use functions that are not part of the standard C library but are part of the POSIX.1 (IEEE Standard 1003.1) standard. Using the macros described in feature_test_macros allows you to control the definitions exposed by the system header files.

As far as I know _POSIX_SOURCE is obsolete and you should use _POSIX_C_SOURCE instead.

For example, if you want to use strndup, you have to use

#define _POSIX_C_SOURCE 200809L

See also

  • 1.3.4 Feature Test Macros
  • 5.12 Posix Variants
  • man 7 feature_test_macros
like image 84
Pablo Avatar answered Sep 23 '22 21:09

Pablo