Re: Changes to stdlib.h from ver. 6.0 to ver. 8.0
- From: "Igor Tandetnik" <itandetnik@xxxxxxxx>
- Date: Wed, 19 Sep 2007 15:52:37 -0400
al-s <eastlocust@xxxxxxxxx> wrote:
A project that builds without issue using VC++ ver. 6.0 has errors
when importing it into ver. 8.0 (VS2005).
I get the following error: error C2032: '_errno' : function cannot be
member of struct 'TSK_Obj' C:\spox60\INCLUDE\tsk.h 117
The so-called offending line is part of the C struct below:
typedef struct TSK_Obj {
Int errno; /* TSK_seterr()/TSK_geterr() */ <---- Error points to this
line
} TSK_Obj, *TSK_Handle;
"errno" is a macro that expands to a function call. After this
expansion, the line in question doesn't make any sense.
The bug is not in the standard headers, but in your program. It
shouldn't have used the name "errno" in the first place. From C99
standard:
7.5/2 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 identifier
with the name errno, the behavior is undefined.
I suggest you simply give the field a different name.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
.
- References:
- Prev by Date: Re: how do I find an item in std::list?
- Next by Date: Re: VC++ 6.0 To .NET
- Previous by thread: Changes to stdlib.h from ver. 6.0 to ver. 8.0
- Index(es):
Relevant Pages
|