In article <
aea44a82-92d5-4b04...@googlegroups.com>,
Frederick Virchanza Gotham <
cauldwel...@gmail.com> wrote:
>
>I've run a desktop PC program (x86_64 MS-Windows) through the 'gdb'
>Idebugger and can clearly see that it segfaults when it reads the value
>of 'errno'.
>
>To try understand what's going on, I wrote a minimal program:
>
>#include <errno.h>
>
>int main(void)
>{
> return errno;
>}
>
>and then I compiled it with "-E -P" to get the preprocessor output:
It works OK for me. I note that you posted in C++, but this looks like a
pure C issue. Just to be clear, are you implying that it is a C++only
problem?
Anyway, here is my test program (running on Linux, with tcc):
#!/usr/bin/tcc -run
#include <errno.h>
#include <fcntl.h>
int main(void)
{
/* With this line, returns 2, without it, returns 0 */
int fd = open("/tmp/golisdf",0);
return errno;
}
Note: I'm not saying this is conclusive; just that I could not replicate
your issue. Generally, it should work, but it may be a Windows thing, it
could be a C++ thing, it might be a (whatever compiler you used) issue. It
could be lots of things.
Also, we are all aware that errno got changed recently for compatibility
reasons with threads. I don't know if tcc has that change or not.
--
I voted for Trump because I thought he'd make pussy grabbing legal.
I honestly don't see any other way America could be made great again.