Re: Polyspace Problem



On Feb 28, 10:58 am, mark_blue...@xxxxxxxxx wrote:
On Feb 28, 9:44 am, "hyderabadblues" <sirishku...@xxxxxxxxx> wrote:

Hi,

I am using polyspace tool.

That's irrelevant, I think, and making that part of your subject makes
it less likely that people will respond. Your problem is simply a C
language issue.

When I compile the following code I am getting the error as
__true_type undefined

This is because you haven't defined a type called "__true_type".



struct __true_type{

};

Here you've defined a structure type called "__true_type". (BTW, I
have a feeling that using "__" as the start of an identifier is
against the standard. That namespace is, I think, reserved for
implementors).



struct __type_traits{

typedef __true_type _h;

Here you're trying to define that "_h" (again a leading "_" is not
recommended, I seem to recall) is a way of referring to the data type
"__true_type" which you haven't defined.



};

Can anybody help me regarding this

I'm not totally sure what you are trying to achieve here, so it's not
easy.

I suspect you need to reread your reference books to understand what
typedef does and what it's for.

One approach to what I think you are trying to do would be :-

typedef struct __true_type true_type_t;
struct __true_type{

};

struct __type_traits{

true_type_t _h;

};


Actually the code is a extract of STL that is designed by us.I have
modified it to make it easy.
But the same code does not give any error in VC++ compiler

.



Relevant Pages

  • Re: Strange Behavior
    ... increments, but I suspect you are hitting one of the following: ... why is this a struct? ... But try making it a class; I suspect this will fix everything. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Remaining u32 vs. pm_message_t fixes
    ... I suspect there's more than that still remaining. ... $ grep suspend include/asm-arm -r ... changing pm_message_t to a struct. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Etymology of "struct"
    ... to emphasize that a struct, not a typedef, is the way to create a new ... User-defined abstraCT type", which I suspect was in part designed to be ...
    (comp.lang.c)
  • Re: Etymology of "struct"
    ... to emphasize that a struct, not a typedef, is the way to create a new ... User-defined abstraCT type", which I suspect was in part designed to be ...
    (comp.lang.c)
  • Re: [patch 02/12] fuse: fix race between getattr and write
    ... struct fuse_req *req; ... You might want to do this operation in a little helper ... Because I suspect that the lock isn't needed if CONFIG_64BIT=y. ...
    (Linux-Kernel)