Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
davidt84
11 months ago
|
parent
|
context
|
favorite
| on:
C stdlib isn't threadsafe and even safe Rust didn'...
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).
kazinator
11 months ago
[–]
I'm surprised C++ would have anything to say about
getenv
; mostly it just includes the standard C library via normative reference.
davidt84
11 months ago
|
parent
[–]
Nevertheless,
https://en.cppreference.com/w/cpp/utility/program/getenv
kazinator
11 months ago
|
root
|
parent
[–]
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.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: