Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
davidt84
1y ago
0 comments
Save
Share
Hmm, I'm apparently correct for C++11, where calling getenv only is thread safe, but that's not guaranteed by earlier standards (or, as far as I can tell, by C or POSIX).
0 comments
3 comments · 1 top-level
top
newest
oldest
kazinator
1y ago
· 2 in thread
I'm surprised C++ would have anything to say about
getenv
; mostly it just includes the standard C library via normative reference.
davidt84
OP
1y ago
Nevertheless,
https://en.cppreference.com/w/cpp/utility/program/getenv
kazinator
1y ago
Interesting. So in a multi-threaded C++ program that only calls the std:: getenv function, everything is fine.
If anything calls the C getenv function, like a third party library, things are maybe not fine.
j
/
k
navigate · click thread line to collapse