Re: Polyspace Problem



On Feb 28, 11:33 am, Beej Jorgensen <b...@xxxxxxx> wrote:
hyderabadblues <sirishku...@xxxxxxxxx> wrote:
__true_type undefined

__true_type isn't defined. The full name of the type is "struct
__true_type":

struct __true_type{
};

I don't know what your intent is here:

struct __type_traits{
typedef __true_type _h; [<-- this is where the error is!]
};

If you're trying to declare a field _h in struct __type_traits, then the
proper syntax would be:

struct __type_traits {
struct __true_type _h;
};

But if you're trying to typedef _h as a synonym for struct __true_type,
you can't do that inside the struct. Moving it outside the struct, the
syntax would be:

typedef struct __true_type _h;

On top of all that, I believe identifiers with two leading underscores
(even as struct names) are reserved (c99 7.1.3p1). And that last _h
typedef probably violates the same section if it's at file scope.
Someone should probably confirm or deny this, since I'm not entirely
sure on it.

-Beej

Problem is solved when I put struct after typedef...
But actual code looks comething like this

struct __true_type{

};

struct __false_type{

};
struct __state_type{

};


struct __type_traits{

typedef __true_type _h;
typedef __false_type _h;
typedef __state_type _h;
};


When I compiled the above code I got three errors,
__true_type isn't defined
__false_type isn't defined
__state_type isn't defined

but after changing the code to

struct __type_traits{

typedef struct __true_type _h;
typedef __false_type _h;
typedef __state_type _h;
};

There are no errors. Why is this

.



Relevant Pages

  • Re: Polyspace Problem
    ... hyderabadblues wrote: ... I don't know what your intent is here: ... proper syntax would be: ... you can't do that inside the struct. ...
    (comp.lang.c)
  • Re: Polyspace Problem
    ... proper syntax would be: ... you can't do that inside the struct. ... that'll compile under a conforming C compiler. ...
    (comp.lang.c)
  • Re: [patch] ipc/msg.c: clean up coding style
    ... was an inconsistent hodepodge of various coding styles) ... Moving * to name is OK, but lining up all names is probably not. ... struct msg_queue *msq; ... Let's not go BSD way. ...
    (Linux-Kernel)
  • [3/9] Lustre VFS patches for 2.6
    ... This patch adds intent opertion and intent release callback to ... struct open_intent, so that interested code ... extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *)); ...
    (Linux-Kernel)
  • Re: [patch] ipc/msg.c: clean up coding style
    ... Moving * to name is OK, but lining up all names is probably not. ... +asmlinkage long sys_msgget ... struct msg_queue *msq; ... Let's not go BSD way. ...
    (Linux-Kernel)