Re: Polyspace Problem



"hyderabadblues" <sirishkumar@xxxxxxxxx> writes:
When I compile the following code I am getting the error as
__true_type undefined


struct __true_type{
};

struct __type_traits{

typedef __true_type _h;
};

Get rid of the leading underscores. Identifiers starting with an
underscore are reserved to the implementation. Some are reserved for
all purposes, others only at file scope; it's easier to avoid leading
underscores altogether than to remember the detailed rules.

A declaration:

struct foo { /* ... */ };

creates a type called "struct foo". You can't refer to it as just
"foo". <OT>C++ does let you refer to it as "foo"; make sure your
compiler is being invoked as a C compiler so it catches these
errors.</OT>

The only things that should appear between the "{" and "}" of a struct
declaration are member declarations. Putting typedefs inside a struct
declaration is illegal and just doesn't make any sense.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.



Relevant Pages

  • Re: How to pass a struct to a function
    ... write an expression evaluating to your struct -- the name of a variable ... you haven't declared a type "struct entry". ... about how this declaration is handled, ... on which compiler you're using, but any decent compiler will print ...
    (comp.lang.c)
  • Re: void * vs char *
    ... cast p to a (struct s*) to avoid a compile-time error. ... struct s {int a;}; ... function call consists solely of an identifier, and if no declaration ... And see what your compiler has to say. ...
    (comp.lang.c)
  • my wits end - compiling 8.4.9
    ... and never had an issue even on the same OS and compiler version. ... checking whether struct tm is in sys/time.h or time.h... ... checking for gettimeofday declaration... ...
    (comp.lang.tcl)
  • Re: Origin of size_t? Curious.
    ... >>> If the size cannot be taken, then how can sizeof do ... >> contains a declaration of type that is too large, ... > My compiler accepts the oversized declaration, ... at the point of struct declaration. ...
    (comp.lang.c)
  • Re: legality of forward declaration
    ... struct ForwardDeclared; ... void foo; ... gcc and Microsoft C compiler compile it ... declaration of your `struct`. ...
    (comp.lang.c)