Hi,
I am using polyspace tool.
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;
};
Can anybody help me regarding this 17 2405
On Feb 28, 9:44 am, "hyderabadblues" <sirishku...@gmail.comwrote:
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;
};
On Feb 28, 10:58 am, mark_blue...@pobox.com wrote:
On Feb 28, 9:44 am, "hyderabadblues" <sirishku...@gmail.comwrote:
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
hyderabadblues wrote:
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
If you're asking a C++ question, the best help we can give you is
"ask in the C++ newsgroup".
--
Chris "electric hedgehog" Dollin
"It took a very long time, much longer than the most generous estimates."
- James White, /Sector General/
hyderabadblues <si*********@gmail.comwrote:
>__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
On Feb 28, 11:33 am, Beej Jorgensen <b...@beej.uswrote:
hyderabadblues <sirishku...@gmail.comwrote:
__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
hyderabadblues <si*********@gmail.comwrote:
>struct __type_traits{
typedef struct __true_type _h; typedef __false_type _h; typedef __state_type _h; };
There are no errors. Why is this
I don't know. When I try to compile that code with gcc I get errors all
over the place.
-Beej
In article <11**********************@v33g2000cwv.googlegroups .com>,
hyderabadblues <si*********@gmail.comwrote:
>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
Perhaps that's because it's a C++ compiler? This is a C newsgroup!
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
hyderabadblues <si*********@gmail.comwrote:
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;
};
Why would you make a typedef part of structure? That looks rather
strange, to say the least, and definitely nothing I would assume
a compiler to let me get away with. And even if that would be
possible why would you give all three the same name ('_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
You either have totally confused your compiler or you're not
posting your real code.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
On 28 Feb, 10:17, "hyderabadblues" <sirishku...@gmail.comwrote:
On Feb 28, 10:58 am, mark_blue...@pobox.com wrote:
On Feb 28, 9:44 am, "hyderabadblues" <sirishku...@gmail.comwrote:
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.
In other words, you're not showing us the code that's really relevant?
But the same code does not give any error in VC++ compiler
What language do you _think_ you are coding in? C? C++? Some peculiar
hybrid/mongrel supported by a particular compiler?
I know too little of C++ to comment on that, but any conforming C
compiler should, as far as I can tell, reject your code.
hyderabadblues wrote:
On Feb 28, 11:33 am, Beej Jorgensen <b...@beej.uswrote:
hyderabadblues <sirishku...@gmail.comwrote:
>__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.
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;
};
I still don't think this is the actual code; atleast it's not code
that'll compile under a conforming C compiler.
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
There *should* still be errors. If there aren't then your compiler is
not compiling under a conforming C mode.
"hyderabadblues" <si*********@gmail.comwrites:
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) ks***@mib.org <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"
On Wed, 28 Feb 2007 11:55:29 -0800, Keith Thompson <ks***@mib.org>
wrote:
>"hyderabadblues" <si*********@gmail.comwrites:
>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.
Sad to say, the OP claims to *be* an implementer:
"Actually the code is a extract of STL that is designed by us"
I'm quite interested in the outcome of a project which is apparently
trying to implement the C++ STL in C. It must be a challenge.
--
Al Balmer
Sun City, AZ
On Feb 28, 8:55 pm, Keith Thompson <k...@mib.orgwrote:
"hyderabadblues" <sirishku...@gmail.comwrites:
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>
<OT>Actually, OP's compiler must be a C++ compiler, since typedef-
within-a-struct seems to be legal in C++. An example from working
draft ISO:
struct X {
typedef int T;
static T count;
void f(T);
};
void X::f(T t = count ) { }
</OT>
--
WYCIWYG - what you C is what you get
Al Balmer <al******@att.netwrites:
On Wed, 28 Feb 2007 11:55:29 -0800, Keith Thompson <ks***@mib.org>
wrote:
>>"hyderabadblues" <si*********@gmail.comwrites:
>>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.
Sad to say, the OP claims to *be* an implementer:
"Actually the code is a extract of STL that is designed by us"
STL being the C++ Standard Template Library.
I'm quite interested in the outcome of a project which is apparently
trying to implement the C++ STL in C. It must be a challenge.
Yes, but an STL implementation in C would not be part of the C
implementation.
Hmm, I don't *think* it would be. A library that's not part of the
standard C library, but that is perhaps integrated along with the
stuff that is required by the standard, is in a twilight zone between
the implementation and user code.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <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"
On Wed, 28 Feb 2007 13:22:06 -0800, Keith Thompson <ks***@mib.org>
wrote:
>Al Balmer <al******@att.netwrites:
>On Wed, 28 Feb 2007 11:55:29 -0800, Keith Thompson <ks***@mib.org> wrote:
>>>"hyderabadblues" <si*********@gmail.comwrites: 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.
Sad to say, the OP claims to *be* an implementer:
"Actually the code is a extract of STL that is designed by us"
STL being the C++ Standard Template Library.
I assumed so.
>
>I'm quite interested in the outcome of a project which is apparently trying to implement the C++ STL in C. It must be a challenge.
Yes, but an STL implementation in C would not be part of the C implementation.
But it would be part of a C++ implementation, wouldn't it? I haven't
actually looked at the standard in a long time, but I thought the STL
was adopted as part of the language. (I don't even remember if the
reserved namespaces are similar.)
> Hmm, I don't *think* it would be. A library that's not part of the standard C library, but that is perhaps integrated along with the stuff that is required by the standard, is in a twilight zone between the implementation and user code.
--
Al Balmer
Sun City, AZ
Al Balmer <al******@att.netwrites:
On Wed, 28 Feb 2007 13:22:06 -0800, Keith Thompson <ks***@mib.org>
wrote:
[...]
>>Yes, but an STL implementation in C would not be part of the C implementation.
But it would be part of a C++ implementation, wouldn't it? I haven't
actually looked at the standard in a long time, but I thought the STL
was adopted as part of the language. (I don't even remember if the
reserved namespaces are similar.)
<OT>Yes.</OT>
--
Keith Thompson (The_Other_Keith) ks***@mib.org <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"
"matevzb" <ma*****@gmail.comwrites:
[...]
<OT>Actually, OP's compiler must be a C++ compiler, since typedef-
within-a-struct seems to be legal in C++. An example from working
draft ISO:
struct X {
typedef int T;
static T count;
void f(T);
};
void X::f(T t = count ) { }
That makes sense (for C++, not so much for C). In C++, a struct is
almost exactly the same thing as a class, which is a fundamental unit
of encapsulation as well as a data type.
</OT>
If someone wants to implement something STL-like in C, that's just one
of the many things that will have to be dealt with. (If I needed the
STL, I'd probably just use C++.)
--
Keith Thompson (The_Other_Keith) ks***@mib.org <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" This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bruce Davis |
last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded
tkinter gui application. The problem appears to be a deadlock condition
when a child thread pops up a
Pmw dialog window in...
|
by: Kostatus |
last post by:
I have a virtual function in a base class, which is then overwritten by a
function of the same name in a publically derived class. When I call the
function using a pointer to the derived class...
|
by: Refky Wahib |
last post by:
Hi
I need Technical Support
I finished a Great project using .Net and SQL Server and .Net Mobile
Control
My Business case is to implement this Program to accept about 1
Million concurrent...
|
by: Sudesh Sawant |
last post by:
Hello,
We have an application which communicates using remoting. There is a server
which is a Windows Service. The server exposes an object which is a
singleton. The client is a Web Application...
|
by: Peter Olcott |
last post by:
www.halting-problem.com
| |
by: Jon Davis |
last post by:
If I have a class with a virtual method, and a child class that overrides
the virtual method, and then I create an instance of the child class AS A
base class...
BaseClass bc = new ChildClass();...
|
by: Ammar |
last post by:
Dear All,
I'm facing a small problem.
I have a portal web site, that contains articles, for each article, the end
user can send a comment about the article.
The problem is:
I the comment length...
|
by: Dany |
last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
|
by: Mike Collins |
last post by:
I cannot get the correct drop down list value from a drop down I have on my
web form. I get the initial value that was loaded in the list.
It was asked by someone else what the autopostback was...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |