Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: Which exception for a buffer overrun? Date: Wed, 16 Oct 2019 15:34:52 -0700 Organization: None to speak of Lines: 24 Message-ID: References: <3cf9a0eb-088d-4c7f-903c-d0d40a9e1a8e@googlegroups.com> <4aaa75f3-a489-49bd-89cf-356ece235d21@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="23aeadce0f0c83a8e511abf23a19647d"; logging-data="20716"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/IYm8afQnk5rWrXm8lyi1m" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:Gc4yXypZKXagRMfj+bkaqbZV6JI= sha1:Nvddwz5NSbj88A9nZsdg77gOvoI= Xref: csiph.com comp.lang.c++:69264 Paavo Helde writes: > On 16.10.2019 0:59, Soviet_Mario wrote: >> One thing I really can't stand is the way C used to share a single >> variable (errno) to store status, that may be overwritten unpredictably > > It's not a single variable, it's a single variable per thread. Right. The standard says errno is a macro "which expands to a modifiable lvalue that has type int and thread local storage duration, the value of which is set to a positive error number by several library functions". On my system, the errno macro expands to (*__errno_location ()) where the __errno_location function presumably returns a pointer to a thread-local int object. This was introduced in C11. In C90 and C99, thread local storage did not exist, but implementations could do something equivalent. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */