Topic: standard compliance typedef-ed code


Author: "Joe Smith" <unknown_kev_cat@hotmail.com>
Date: Sun, 15 Feb 2009 12:06:07 CST
Raw View
"Steve Clamage" <stephen.clamage@sun.com> wrote in message
news:lq5so49jv67emt1mubgq1ermi6nl65ngot@4ax.com...
> On Sat, 24 Jan 2009 02:48:37 CST, "Joe Smith"
> <unknown_kev_cat@hotmail.com> wrote:
>
>>
>>Questions about standard C++ are better asked in comp.lang.c++ or
>>comp.lang.c++.moderated. This group is generally more about the
>>continued development of the C++ standard, reporting defects in the
>>standard, suggesting new features, etc.
>
> Not so. Quoting from the newsgroup FAQ:
>
> A2.  How can I tell whether my post belongs in comp.std.c++, in
> comp.lang.c++, or somewhere else?
>
> If you're talking specifically about the C++ standard, or about how
> the C++ language itself is designed, or about recent changes to the
> language, then your post probably belongs in comp.std.c++.

That really is somewhat out of date. These days comp.lang.c++ and
comp.lang.c++.moderated have enforced their standard-c++ only rules to the
extent that the vast majority of threads include C++ standard citations.
One
is definately much more likely to reveive a timely answer to most C++
standard questions on c.l.c++.moderated than on comp.std.c++, and the
quality of the answers recived would not differ signifcantly from those
recived on comp.std.c++.

The long break in service of comp.std.c++ has helped to ensure that
would be
the case.

That leaves comp.std.c++ free to be discussions on the continued
development
of the standard, which is what it is best at anyway. I'm not saying other
questions are off-topic, but comp.std.c++ is definately not currently the
best place for general questions about the C++ standard, if for no other
reason than fairly slow response times to many questions.

comp.std.c++ most definately is the best place for raising concerns about
new language features, as comittee members are quite likely to notice
issues
raised here. (much moreso than if posted in c.l.c++, and still a bit moreso
than if posted in c.l.c++.moderated).

> If you're
> talking about how to write C++ programs (if you want to know how to do
> something in C++, for example), then your post probably belongs in
> comp.lang.c++.moderated or comp.lang.c++.

This is true.

> If you're talking about
> general issues that aren't unique to C++ (algorithms, for example, or
> object-oriented design), then you might want to consider
> comp.programming, comp.lang.misc, or comp.object.

Also true.


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Steve Clamage <stephen.clamage@sun.com>
Date: Sun, 8 Feb 2009 20:36:41 CST
Raw View
On Sat, 24 Jan 2009 02:48:37 CST, "Joe Smith"
<unknown_kev_cat@hotmail.com> wrote:

>
>Questions about standard C++ are better asked in comp.lang.c++ or
>comp.lang.c++.moderated. This group is generally more about the
>continued development of the C++ standard, reporting defects in the
>standard, suggesting new features, etc.

Not so. Quoting from the newsgroup FAQ:

A2.  How can I tell whether my post belongs in comp.std.c++, in
comp.lang.c++, or somewhere else?

If you're talking specifically about the C++ standard, or about how
the C++ language itself is designed, or about recent changes to the
language, then your post probably belongs in comp.std.c++. If you're
talking about how to write C++ programs (if you want to know how to do
something in C++, for example), then your post probably belongs in
comp.lang.c++.moderated or comp.lang.c++. If you're talking about
general issues that aren't unique to C++ (algorithms, for example, or
object-oriented design), then you might want to consider
comp.programming, comp.lang.misc, or comp.object.

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Severin Ecker <secker@gmx.at>
Date: Fri, 23 Jan 2009 16:15:25 CST
Raw View

hi,



I'm currently working on/with a project and stumbled over a piece of

code which compiled just fine on VC05, VC08, gcc 4.1.1 but not on code

warrior. Then again if i use the stlport stl implementation the code

fails to compile on VC and gcc as well complaining because of the usage

of an undefined type (while compiling the 2nd typedef).



#include <vector>



struct Test;



typedef std::vector<Test> TestVec;

typedef TestVec::const_iterator TestVecIt;





So, actually I'm wondering whether this code complies to the c++

standard (on the one hand i thought templates are only evaluated when

they're instantiated, on the other hand the 2nd typedef needs to know

vector... hmm), but if not if there's any way i can get this to comply

(and compile) without the need to rewrite it using pointers to Test

(aka: std::vector<Test*>)



many thanks in advance!



cheers,

severin



--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: "Joe Smith" <unknown_kev_cat@hotmail.com>
Date: Sat, 24 Jan 2009 02:48:37 CST
Raw View
"Severin Ecker" <secker@gmx.at> wrote in message
news:7ff96$497a2b04$5472197a$5106@news.chello.at...
>
>
> hi,
>
> I'm currently working on/with a project and stumbled over a piece of
> code which compiled just fine on VC05, VC08, gcc 4.1.1 but not on code
> warrior. Then again if i use the stlport stl implementation the code
> fails to compile on VC and gcc as well complaining because of the usage
> of an undefined type (while compiling the 2nd typedef).
>
>
>
> #include <vector>
>
> struct Test;
>
> typedef std::vector<Test> TestVec;
> typedef TestVec::const_iterator TestVecIt;
>
> So, actually I'm wondering whether this code complies to the c++
> standard (on the one hand i thought templates are only evaluated when
> they're instantiated, on the other hand the 2nd typedef needs to know
> vector... hmm), but if not if there's any way i can get this to comply
> (and compile) without the need to rewrite it using pointers to Test
> (aka: std::vector<Test*>)
>
> many thanks in advance!
>

You are running into the issue that instantiating a standard container
with an incomplete type is undefined behavior.

Is there some reason why you really need to have these typedefs come
before the definition of the struct in question?

Questions about standard C++ are better asked in comp.lang.c++ or
comp.lang.c++.moderated. This group is generally more about the
continued development of the C++ standard, reporting defects in the
standard, suggesting new features, etc. It is also arguably the best
group to ask questions about the current draft standard, since the
other groups tend to focusd on the released standards.

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Severin Ecker <secker@gmx.at>
Date: Sat, 24 Jan 2009 18:15:13 CST
Raw View



Joe Smith wrote:

>

> "Severin Ecker" <secker@gmx.at> wrote in message

> news:7ff96$497a2b04$5472197a$5106@news.chello.at...

>>

>>

>> hi,

>>

>> I'm currently working on/with a project and stumbled over a piece of

>> code which compiled just fine on VC05, VC08, gcc 4.1.1 but not on code

>> warrior. Then again if i use the stlport stl implementation the code

>> fails to compile on VC and gcc as well complaining because of the usage

>> of an undefined type (while compiling the 2nd typedef).

>>

>>

>>

>> #include <vector>

>>

>> struct Test;

>>

>> typedef std::vector<Test> TestVec;

>> typedef TestVec::const_iterator TestVecIt;

>>

>> So, actually I'm wondering whether this code complies to the c++

>> standard (on the one hand i thought templates are only evaluated when

>> they're instantiated, on the other hand the 2nd typedef needs to know

>> vector... hmm), but if not if there's any way i can get this to comply

>> (and compile) without the need to rewrite it using pointers to Test

>> (aka: std::vector<Test*>)

>>

>> many thanks in advance!

>>

>

> You are running into the issue that instantiating a standard container

> with an incomplete type is undefined behavior.

>

> Is there some reason why you really need to have these typedefs come

> before the definition of the struct in question?

>

> Questions about standard C++ are better asked in comp.lang.c++ or

> comp.lang.c++.moderated. This group is generally more about the

> continued development of the C++ standard, reporting defects in the

> standard, suggesting new features, etc. It is also arguably the best

> group to ask questions about the current draft standard, since the

> other groups tend to focusd on the released standards.

>

> --

> [ comp.std.c++ is moderated.  To submit articles, try just posting with ]

> [ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]

> [              --- Please see the FAQ before posting. ---               ]

> [ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

>



hi joe,



thanks for the reply.



well it's not that I want to have that code but I'm using an external

library/project where this code was written. having lots of cyclic

dependencies there I can't really remove or move to another source file

so i fear i have to rewrite that code to use pointers instead.



cheers,

severin



ps.: thanks for the info about the purpose of this newsgroup, i

misinterpreted the name :)



--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]