Re: detecting symbolic links in c
From: Mac (foo_at_bar.net)
Date: 04/22/04
- Next message: Mac: "Re: detecting symbolic links in c"
- Previous message: David Schwartz: "Re: What's the cleanest way to wake a poll?"
- In reply to: Brian Raiter: "Re: detecting symbolic links in c"
- Next in thread: Rich Teer: "Re: detecting symbolic links in c"
- Reply: Rich Teer: "Re: detecting symbolic links in c"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 21 Apr 2004 20:48:45 -0700
On Mon, 19 Apr 2004 22:17:49 +0000, Brian Raiter wrote:
>> I agree with all your arguments except this last one. Errno isn't a
>> function, so different rules apply.
>
> On what do you base that assertion? How do you know errno can never be
> a macro encapsulating a function? For that matter, how do you know
> errno can never be a short? Or a long? Or unsigned, for that matter?
>
> Unless memory fails me, I don't believe ANSI or POSIX makes any promise
> other than that "errno" is some kind of object that can be compared
> with positive integral values. I'm not even sure it requires that
> errno be "non-const".
>
> b
>From the standard:
The header <errno.h> defines several macros, [...] and
errno
which expands to a modifiable lvalue/83/ that has type int , the value
of which is set to a positive error number by several library
functions. It is unspecified whether errno is a macro or an
identifier declared with external linkage. If a macro definition is
suppressed in order to access an actual object, or a program defines
an external identifier with the name errno, the behavior is
undefined.
--------------end of quote-----------------------
So, I guess it is not a good idea for me to declare it, after all. Doing
so could result in a syntax error if errno is a macro. But it is clearly
intended to have integer-like behavior, since it is modifiable lvalue of
type int.
And of course, "extern int errno" is not technically a definition, so it
doesn't explicitly violate the text above.
I don't know what posix says about errno, but from now on I won't be
declaring it in any functions I write.
--Mac
- Next message: Mac: "Re: detecting symbolic links in c"
- Previous message: David Schwartz: "Re: What's the cleanest way to wake a poll?"
- In reply to: Brian Raiter: "Re: detecting symbolic links in c"
- Next in thread: Rich Teer: "Re: detecting symbolic links in c"
- Reply: Rich Teer: "Re: detecting symbolic links in c"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|