Tuesday, February 2, 2010

comp.lang.c++ - 25 new messages in 10 topics - digest

comp.lang.c++
http://groups.google.com/group/comp.lang.c++?hl=en

comp.lang.c++@googlegroups.com

Today's topics:

* Incomplete types and std::vector - 7 messages, 6 authors
http://groups.google.com/group/comp.lang.c++/t/b0741c38fc15b5f7?hl=en
* Interesting observation (predicate with std::sort) - 4 messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/66887f988a85b73f?hl=en
* Seeking typical C++ source code. Help please! - 4 messages, 4 authors
http://groups.google.com/group/comp.lang.c++/t/772085c9212fa2e7?hl=en
* Wierd errors of file devguid.h - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/3c3bc589f581d785?hl=en
* Rs 20,000 INR at stake in CodeWarrior - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.c++/t/3a8c7798a693bfcc?hl=en
* On the Square-Rectangle Problem - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/17378f3e6e3294ba?hl=en
* memory leaks - 2 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/d9b20823062f2cb3?hl=en
* Another strange linux kernel change - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/e05a4158a9750a03?hl=en
* Looking for C++ IDE,... - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/e8a1db0949215858?hl=en
* C++0x regex supported by gcc? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/a5e3fb25be9236a9?hl=en

==============================================================================
TOPIC: Incomplete types and std::vector
http://groups.google.com/group/comp.lang.c++/t/b0741c38fc15b5f7?hl=en
==============================================================================

== 1 of 7 ==
Date: Tues, Feb 2 2010 10:54 am
From: Stephen Howe


Hi

is this legal?

// Start Header File TEST.h
#include <vector>

class CTest
{
public:
CTest();
~CTest();

private:
struct Incomplete;
std::vector<Incomplete> Vec_;

private:
CTest(const CTest &);
CTest &operator = (const CTest &);
};
// End Header File TEST.h

I wasnt sure of the position of incomplete types with standard containers.
VS2005 does not seem to mind but that is not a benchmark.

Thanks

Stephen Howe


== 2 of 7 ==
Date: Tues, Feb 2 2010 10:59 am
From: Victor Bazarov


Stephen Howe wrote:
> is this legal?

Don't have a quote from the Standard ready, but somehow I recall that
it's not legal. Look through the archives for "instantiate templates
incomplete types C++" (or something like that, without quotes).

> // Start Header File TEST.h
> #include <vector>
>
> class CTest
> {
> public:
> CTest();
> ~CTest();
>
> private:
> struct Incomplete;
> std::vector<Incomplete> Vec_;
>
> private:
> CTest(const CTest &);
> CTest &operator = (const CTest &);
> };
> // End Header File TEST.h
>
> I wasnt sure of the position of incomplete types with standard containers.
> VS2005 does not seem to mind but that is not a benchmark.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


== 3 of 7 ==
Date: Tues, Feb 2 2010 11:48 am
From: Stephen Howe


On Tue, 02 Feb 2010 13:59:58 -0500, Victor Bazarov <v.Abazarov@comAcast.net> wrote:

>Stephen Howe wrote:
>> is this legal?
>
>Don't have a quote from the Standard ready, but somehow I recall that
>it's not legal. Look through the archives for "instantiate templates
>incomplete types C++" (or something like that, without quotes).

Thanks Victor. It is not legal

I found Matt Austerns article here

The Standard Librarian: Containers of Incomplete Types
http://www.drdobbs.com/cpp/184403814

which is useful and good except I dont beleive he is right on one point.

You can have function declarations (not definitions) where the arguments and return type are incomplete types.
You are not restricted to just references or pointers to incomplete types, but the actual types themselves.
Of course you need the full type if, say, defining an inline function.

S


== 4 of 7 ==
Date: Tues, Feb 2 2010 12:10 pm
From: "Alf P. Steinbach"


* Stephen Howe:
> On Tue, 02 Feb 2010 13:59:58 -0500, Victor Bazarov <v.Abazarov@comAcast.net> wrote:
>
>> Stephen Howe wrote:
>>> is this legal?
>> Don't have a quote from the Standard ready, but somehow I recall that
>> it's not legal. Look through the archives for "instantiate templates
>> incomplete types C++" (or something like that, without quotes).
>
> Thanks Victor. It is not legal
>
> I found Matt Austerns article here
>
> The Standard Librarian: Containers of Incomplete Types
> http://www.drdobbs.com/cpp/184403814
>
> which is useful and good except I dont beleive he is right on one point.
>
> You can have function declarations (not definitions) where the arguments
> and return type are incomplete types.

Yes.

To be precise, Matt Austern, then chair of the library working group of the C++
standardization committee, wrote "You can't pass or return incomplete types by
value, for the same reason that you can't define variables of an incomplete
type.", in the context of function declarations, and that's wrong.

Another case of a well-known expert getting this wrong is the GOTW on PIMPL,
where Herb Sutter, chair of the standardization committee, used std::auto_ptr
with incomplete type...

From which we might conclude that committee chairs don't go well with
incomplete types.

Or, there's something there.


Cheers,

- Alf


== 5 of 7 ==
Date: Tues, Feb 2 2010 1:34 pm
From: Branimir Maksimovic


Alf P. Steinbach wrote:
>
> Another case of a well-known expert getting this wrong is the GOTW on
> PIMPL, where Herb Sutter, chair of the standardization committee, used
> std::auto_ptr with incomplete type...
>
> From which we might conclude that committee chairs don't go well with
> incomplete types.
>
I think that there was discussion about pimpl idiom (several years ago),
incomplete types and auto_ptr. As I remember catch was that destructor
of envelope class has to be in implementation file where definition of
type was visible, as if not, then, auto_ptr deletes incomplete type.

Greets


== 6 of 7 ==
Date: Tues, Feb 2 2010 2:30 pm
From: James Kanze


On Feb 2, 9:34 pm, Branimir Maksimovic <bm...@hotmail.com> wrote:
> Alf P. Steinbach wrote:

> > Another case of a well-known expert getting this wrong is
> > the GOTW on PIMPL, where Herb Sutter, chair of the
> > standardization committee, used std::auto_ptr with
> > incomplete type...

> > From which we might conclude that committee chairs don't go
> > well with incomplete types.

> I think that there was discussion about pimpl idiom (several
> years ago), incomplete types and auto_ptr. As I remember catch
> was that destructor of envelope class has to be in
> implementation file where definition of type was visible, as
> if not, then, auto_ptr deletes incomplete type.

That's not the issue, at least not formally. The standard
clearly says that it is undefined behavior to instantiate any of
the templates defined in the standard over an undefined type.
Typically, auto_ptr will only need to know the complete type in
the destructor, and you will get away with it if the destructor
of the pimpl is not inlined. But that's just a case of
undefined behavior happening to work, and you won't get away
with it if the implementation uses concepts. (And the next
version of the standard will, I think, require a diagnostic. At
least if concepts make it in.)

--
James Kanze


== 7 of 7 ==
Date: Tues, Feb 2 2010 3:25 pm
From: Joshua Maurice


On Feb 2, 2:30 pm, James Kanze <james.ka...@gmail.com> wrote:
> On Feb 2, 9:34 pm, Branimir Maksimovic <bm...@hotmail.com> wrote:
>
> > Alf P. Steinbach wrote:
> > > Another case of a well-known expert getting this wrong is
> > > the GOTW on PIMPL, where Herb Sutter, chair of the
> > > standardization committee, used std::auto_ptr with
> > > incomplete type...
> > > From which we might conclude that committee chairs don't go
> > > well with incomplete types.
> > I think that there was discussion about pimpl idiom (several
> > years ago), incomplete types and auto_ptr. As I remember catch
> > was that destructor of envelope class has to be in
> > implementation file where definition of type was visible, as
> > if not, then, auto_ptr  deletes incomplete type.
>
> That's not the issue, at least not formally.  The standard
> clearly says that it is undefined behavior to instantiate any of
> the templates defined in the standard over an undefined type.
> Typically, auto_ptr will only need to know the complete type in
> the destructor, and you will get away with it if the destructor
> of the pimpl is not inlined.  But that's just a case of
> undefined behavior happening to work, and you won't get away
> with it if the implementation uses concepts.  (And the next
> version of the standard will, I think, require a diagnostic.  At
> least if concepts make it in.)

Could you explain this to me then? Why was it ever allowed to delete a
pointer to an incomplete type? As I understand it, the compiler must
already know if the type is complete or incomplete. It has to know
which destructor to call at compile time. If it can always detect it,
and it's always an error (aka undefined behavior), why not require a
diagnostic instead of call it undefined behavior? Dittos for deleting
a void pointer. Why allow that? I've hit numerous bugs and wasted a
lot of time tracking down memory leaks because of this IMO silly
mistake in the standard, and because of lack of QoI in modern
commercial compilers. At least gcc will issue warnings about these two
cases with the proper flags, so the script calling gcc can check the
log for these warnings and fail the build. Visual studios
unfortunately will not even issue a warning in one of these cases even
with all of the relevant flags enabled.

==============================================================================
TOPIC: Interesting observation (predicate with std::sort)
http://groups.google.com/group/comp.lang.c++/t/66887f988a85b73f?hl=en
==============================================================================

== 1 of 4 ==
Date: Tues, Feb 2 2010 11:06 am
From: Stephen Howe


On Tue, 02 Feb 2010 12:58:12 -0500, Victor Bazarov <v.Abazarov@comAcast.net> wrote:

>I am sure I'm not the first one to find this, I just hadn't run across
>that behaviour until a few days ago.

Yes I found this out recently. I dont believe the compiler can inline function pointers (what the function decays to) whereas it
can inline functors. Just about the entire STL runs on functors so supplying functors is better.

But I am wondering, what are the benefits to making sure yoru functor is publically derived from unary_function and
binary_function? Can the compiler and/or library do additional optimisations because they can infer sometihng on the types?
I am not seeing any mileage but I would like to be convinced for/against.

Stephen Howe


== 2 of 4 ==
Date: Tues, Feb 2 2010 2:11 pm
From: red floyd


On Feb 2, 11:06 am, Stephen Howe <sjhoweATdialDOTpipexDOTcom> wrote:

> But I am wondering, what are the benefits to making sure yoru functor is publically derived from unary_function and
> binary_function? Can the compiler and/or library do additional optimisations because they can infer sometihng on the types?
> I am not seeing any mileage but I would like to be convinced for/against.
>

Internal typedefs, such as first_argument_type, result_type, etc....


== 3 of 4 ==
Date: Tues, Feb 2 2010 2:21 pm
From: James Kanze


On Feb 2, 5:58 pm, Victor Bazarov <v.Abaza...@comAcast.net> wrote:

> You might find this interesting/useful...

> Using a temporary object as a class predicate with 'std::sort'
> turned out to be faster than using a function pointer.

> My guess is that the compiler I used (VC9) manages to inline
> the functor code (a member function operator()) better than it
> can a stand-alone function when they are used as the predicate
> of 'std::sort'.

In general, if you use a pointer to a function, the type the
compiler instantiates the template over is something like bool
(*f)( int, int ). You can use a lot of different functions with
that instantiation, so unless the compiler inlines everything
(so that the fact that the function pointer is a constant
propagates down to the lowest level), it has to use a call
through the pointer. If you use a functional object, the type
is FunctionalObject; there's only one possible function that can
be called, and the compiler can inline it even if it doesn't
inline the sort function itself.

> I am sure I'm not the first one to find this, I just hadn't
> run across that behaviour until a few days ago.

It's a more or less well known fact. For appropriate meanings
of "well known" and "fact".

--
James Kanze


== 4 of 4 ==
Date: Tues, Feb 2 2010 2:24 pm
From: James Kanze


On Feb 2, 7:06 pm, Stephen Howe <sjhoweATdialDOTpipexDOTcom> wrote:
> On Tue, 02 Feb 2010 12:58:12 -0500, Victor Bazarov
> <v.Abaza...@comAcast.net> wrote:
> >I am sure I'm not the first one to find this, I just hadn't
> >run across that behaviour until a few days ago.

> Yes I found this out recently. I dont believe the compiler can
> inline function pointers (what the function decays to) whereas
> it can inline functors. Just about the entire STL runs on
> functors so supplying functors is better.

In theory, a compiler can inline anything it knows about. The
problem is that the instantiation type doesn't tell the compiler
which function will be called in the case of a pointer to
function; it does in the case of a functional object.

> But I am wondering, what are the benefits to making sure yoru
> functor is publically derived from unary_function and
> binary_function? Can the compiler and/or library do additional
> optimisations because they can infer sometihng on the types?

> I am not seeing any mileage but I would like to be convinced
> for/against.

It allows your functional object to be combined with other types
defined in <functional>. It has absolutely no effect in
functions like sort.

--
James Kanze

==============================================================================
TOPIC: Seeking typical C++ source code. Help please!
http://groups.google.com/group/comp.lang.c++/t/772085c9212fa2e7?hl=en
==============================================================================

== 1 of 4 ==
Date: Tues, Feb 2 2010 11:15 am
From: Juha Nieminen


Alan Mackenzie wrote:
> Would somebody please recommend some hopefully not too big C++ FOSS
> project which contains source which makes liberal use of C++'s features,
> in particular templates (ideally both using them and defining them).

The C++ standard libraries use templates quite heavily, but if you are
looking for smaller examples, here are a few:

http://utfcpp.sourceforge.net/
http://warp.povusers.org/FSBAllocator/
http://warp.povusers.org/FunctionParser/

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---


== 2 of 4 ==
Date: Tues, Feb 2 2010 11:17 am
From: Paavo Helde


Alan Mackenzie <acm@muc.de> wrote in news:hk9s8n$1pvk$1@colin2.muc.de:

> Hi, clc++,
>
> Would somebody please recommend some hopefully not too big C++ FOSS
> project which contains source which makes liberal use of C++'s features,
> in particular templates (ideally both using them and defining them).
>
> I could do with this since I maintain Emacs C++ mode and need a realistic
> test file, although I'm hardly a C++ hacker.

Maybe Crypto++ (http://www.cryptopp.com/). This is a very C++-ish library,
lots of templates, derivation and combinations of both.

hth
Paavo


== 3 of 4 ==
Date: Tues, Feb 2 2010 2:01 pm
From: Alan Mackenzie


Alan Mackenzie <acm@muc.de> wrote:
> Hi, clc++,

> Would somebody please recommend some hopefully not too big C++ FOSS
> project which contains source which makes liberal use of C++'s
> features, in particular templates (ideally both using them and defining
> them).

Juha, Paavo,

Thanks for these bits of software. They're just what I need, as well as
being interesting in their own right.

--
Alan Mackenzie (Nuremberg, Germany).

== 4 of 4 ==
Date: Tues, Feb 2 2010 4:48 pm
From: Jorgen Grahn


On Tue, 2010-02-02, Alan Mackenzie wrote:
> Hi, clc++,
>
> Would somebody please recommend some hopefully not too big C++ FOSS
> project which contains source which makes liberal use of C++'s features,
> in particular templates (ideally both using them and defining them).
>
> I could do with this since I maintain Emacs C++ mode and need a realistic
> test file, although I'm hardly a C++ hacker.

Then I'm not sure if you should mess around with it too much --
writing code without using it or understanding how people use it is
typically a Bad Idea.

No offense intended, and I'm of course grateful for your work in that
area. It's just that I use c++-mode heavily and am very pleased with
it, arguing that Emacs is the best C++ editor in the world and so on
... I'd hate to see regressions.

I'm also not sure heavily templated code should be the main test
vector. But perhaps you ask for it because you have plenty of plain
C++ code already.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

==============================================================================
TOPIC: Wierd errors of file devguid.h
http://groups.google.com/group/comp.lang.c++/t/3c3bc589f581d785?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Feb 2 2010 11:53 am
From: Johnson


I am developing a C++ program with Visual Studio 2008. After enableing
/clr option in the compiler, I got the following errors. Could anybody
please let me know what is the cause of these errors and how to solve it?

Thank you!

Johnson

1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\devguid.h(15) :
error C2065: 'GUID_DEVCLASS_1394' : undeclared identifier
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\devguid.h(15) :
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\devguid.h(15) :
error C2078: too many initializers
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\devguid.h(16) :
error C2065: 'GUID_DEVCLASS_1394DEBUG' : undeclared identifier
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\devguid.h(16) :
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int
1>C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\devguid.h(16) :
error C2374: 'DEFINE_GUID' : redefinition; multiple initialization
1> C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\devguid.h(15) :
see declaration of 'DEFINE_GUID'
...

/*++ BUILD Version: 0001 // Increment this if a change has global effects

Copyright (c) Microsoft Corporation. All rights reserved.

Module Name:

devguid.h

Abstract:

Defines GUIDs for device classes used in Plug & Play.

--*/

DEFINE_GUID( GUID_DEVCLASS_1394, 0x6bdd1fc1L, 0x810f, 0x11d0, 0xbe,
0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f );
DEFINE_GUID( GUID_DEVCLASS_1394DEBUG, 0x66f250d6L, 0x7801, 0x4a64, 0xb1,
0x39, 0xee, 0xa8, 0x0a, 0x45, 0x0b, 0x24 );
DEFINE_GUID( GUID_DEVCLASS_61883, 0x7ebefbc0L, 0x3200, 0x11d2, 0xb4,
0xc2, 0x00, 0xa0, 0xc9, 0x69, 0x7d, 0x07 );
DEFINE_GUID( GUID_DEVCLASS_ADAPTER, 0x4d36e964L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_APMSUPPORT, 0xd45b1c18L, 0xc8fa, 0x11d1,
0x9f, 0x77, 0x00, 0x00, 0xf8, 0x05, 0xf5, 0x30 );
DEFINE_GUID( GUID_DEVCLASS_AVC, 0xc06ff265L, 0xae09, 0x48f0, 0x81, 0x2c,
0x16, 0x75, 0x3d, 0x7c, 0xba, 0x83 );
DEFINE_GUID( GUID_DEVCLASS_BATTERY, 0x72631e54L, 0x78a4, 0x11d0, 0xbc,
0xf7, 0x00, 0xaa, 0x00, 0xb7, 0xb3, 0x2a );
DEFINE_GUID( GUID_DEVCLASS_BIOMETRIC, 0x53d29ef7L, 0x377c, 0x4d14, 0x86,
0x4b, 0xeb, 0x3a, 0x85, 0x76, 0x93, 0x59 );
DEFINE_GUID( GUID_DEVCLASS_BLUETOOTH, 0xe0cbf06cL, 0xcd8b, 0x4647, 0xbb,
0x8a, 0x26, 0x3b, 0x43, 0xf0, 0xf9, 0x74 );
DEFINE_GUID( GUID_DEVCLASS_CDROM, 0x4d36e965L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_COMPUTER, 0x4d36e966L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_DECODER, 0x6bdd1fc2L, 0x810f, 0x11d0, 0xbe,
0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f );
DEFINE_GUID( GUID_DEVCLASS_DISKDRIVE, 0x4d36e967L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_DISPLAY, 0x4d36e968L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_DOT4, 0x48721b56L, 0x6795, 0x11d2, 0xb1,
0xa8, 0x00, 0x80, 0xc7, 0x2e, 0x74, 0xa2 );
DEFINE_GUID( GUID_DEVCLASS_DOT4PRINT, 0x49ce6ac8L, 0x6f86, 0x11d2, 0xb1,
0xe5, 0x00, 0x80, 0xc7, 0x2e, 0x74, 0xa2 );
DEFINE_GUID( GUID_DEVCLASS_ENUM1394, 0xc459df55L, 0xdb08, 0x11d1, 0xb0,
0x09, 0x00, 0xa0, 0xc9, 0x08, 0x1f, 0xf6 );
DEFINE_GUID( GUID_DEVCLASS_FDC, 0x4d36e969L, 0xe325, 0x11ce, 0xbf, 0xc1,
0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_FLOPPYDISK, 0x4d36e980L, 0xe325, 0x11ce,
0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_GPS, 0x6bdd1fc3L, 0x810f, 0x11d0, 0xbe, 0xc7,
0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f );
DEFINE_GUID( GUID_DEVCLASS_HDC, 0x4d36e96aL, 0xe325, 0x11ce, 0xbf, 0xc1,
0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_HIDCLASS, 0x745a17a0L, 0x74d3, 0x11d0, 0xb6,
0xfe, 0x00, 0xa0, 0xc9, 0x0f, 0x57, 0xda );
DEFINE_GUID( GUID_DEVCLASS_IMAGE, 0x6bdd1fc6L, 0x810f, 0x11d0, 0xbe,
0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f );
DEFINE_GUID( GUID_DEVCLASS_INFINIBAND, 0x30ef7132L, 0xd858, 0x4a0c,
0xac, 0x24, 0xb9, 0x02, 0x8a, 0x5c, 0xca, 0x3f );
DEFINE_GUID( GUID_DEVCLASS_INFRARED, 0x6bdd1fc5L, 0x810f, 0x11d0, 0xbe,
0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f );
DEFINE_GUID( GUID_DEVCLASS_KEYBOARD, 0x4d36e96bL, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_LEGACYDRIVER, 0x8ecc055dL, 0x047f, 0x11d1,
0xa5, 0x37, 0x00, 0x00, 0xf8, 0x75, 0x3e, 0xd1 );
DEFINE_GUID( GUID_DEVCLASS_MEDIA, 0x4d36e96cL, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_MEDIUM_CHANGER, 0xce5939aeL, 0xebde, 0x11d0,
0xb1, 0x81, 0x00, 0x00, 0xf8, 0x75, 0x3e, 0xc4 );
DEFINE_GUID( GUID_DEVCLASS_MODEM, 0x4d36e96dL, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_MONITOR, 0x4d36e96eL, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_MOUSE, 0x4d36e96fL, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_MTD, 0x4d36e970L, 0xe325, 0x11ce, 0xbf, 0xc1,
0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_MULTIFUNCTION, 0x4d36e971L, 0xe325, 0x11ce,
0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_MULTIPORTSERIAL, 0x50906cb8L, 0xba12, 0x11d1,
0xbf, 0x5d, 0x00, 0x00, 0xf8, 0x05, 0xf5, 0x30 );
DEFINE_GUID( GUID_DEVCLASS_NET, 0x4d36e972L, 0xe325, 0x11ce, 0xbf, 0xc1,
0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_NETCLIENT, 0x4d36e973L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_NETSERVICE, 0x4d36e974L, 0xe325, 0x11ce,
0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_NETTRANS, 0x4d36e975L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_NODRIVER, 0x4d36e976L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_PCMCIA, 0x4d36e977L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_PNPPRINTERS, 0x4658ee7eL, 0xf050, 0x11d1,
0xb6, 0xbd, 0x00, 0xc0, 0x4f, 0xa3, 0x72, 0xa7 );
DEFINE_GUID( GUID_DEVCLASS_PORTS, 0x4d36e978L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_PRINTER, 0x4d36e979L, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_PRINTERUPGRADE, 0x4d36e97aL, 0xe325, 0x11ce,
0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_PROCESSOR, 0x50127dc3L, 0x0f36, 0x415e, 0xa6,
0xcc, 0x4c, 0xb3, 0xbe, 0x91, 0x0B, 0x65 );
DEFINE_GUID( GUID_DEVCLASS_SBP2, 0xd48179beL, 0xec20, 0x11d1, 0xb6,
0xb8, 0x00, 0xc0, 0x4f, 0xa3, 0x72, 0xa7 );
DEFINE_GUID( GUID_DEVCLASS_SCSIADAPTER, 0x4d36e97bL, 0xe325, 0x11ce,
0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_SECURITYACCELERATOR, 0x268c95a1L, 0xedfe,
0x11d3, 0x95, 0xc3, 0x00, 0x10, 0xdc, 0x40, 0x50, 0xa5 );
DEFINE_GUID( GUID_DEVCLASS_SIDESHOW, 0x997b5d8dL, 0xc442, 0x4f2e, 0xba,
0xf3, 0x9c, 0x8e, 0x67, 0x1e, 0x9e, 0x21 );
DEFINE_GUID( GUID_DEVCLASS_SMARTCARDREADER, 0x50dd5230L, 0xba8a, 0x11d1,
0xbf, 0x5d, 0x00, 0x00, 0xf8, 0x05, 0xf5, 0x30 );
DEFINE_GUID( GUID_DEVCLASS_SOUND, 0x4d36e97cL, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_SYSTEM, 0x4d36e97dL, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_TAPEDRIVE, 0x6d807884L, 0x7d21, 0x11cf, 0x80,
0x1c, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_UNKNOWN, 0x4d36e97eL, 0xe325, 0x11ce, 0xbf,
0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18 );
DEFINE_GUID( GUID_DEVCLASS_USB, 0x36fc9e60L, 0xc465, 0x11cf, 0x80, 0x56,
0x44, 0x45, 0x53, 0x54, 0x00, 0x00 );
DEFINE_GUID( GUID_DEVCLASS_VOLUME, 0x71a27cddL, 0x812a, 0x11d0, 0xbe,
0xc7, 0x08, 0x00, 0x2b, 0xe2, 0x09, 0x2f );
DEFINE_GUID( GUID_DEVCLASS_VOLUMESNAPSHOT, 0x533c5b84L, 0xec70, 0x11d2,
0x95, 0x05, 0x00, 0xc0, 0x4f, 0x79, 0xde, 0xaf );
DEFINE_GUID( GUID_DEVCLASS_WCEUSBS, 0x25dbce51L, 0x6c8f, 0x4a72, 0x8a,
0x6d, 0xb5, 0x4c, 0x2b, 0x4f, 0xc8, 0x35 );
DEFINE_GUID( GUID_DEVCLASS_WPD, 0xeec5ad98L, 0x8080, 0x425f, 0x92, 0x2a,
0xda, 0xbf, 0x3d, 0xe3, 0xf6, 0x9a );

//
// Define filesystem filter classes used for classification and load
ordering.
// Classes are listed below in order from "highest" (i.e., farthest from the
// filesystem) to "lowest" (i.e., closest to the filesystem).
//
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_ACTIVITYMONITOR, 0xb86dff51L,
0xa31e, 0x4bac, 0xb3, 0xcf, 0xe8, 0xcf, 0xe7, 0x5c, 0x9f, 0xc2 );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_UNDELETE, 0xfe8f1572L, 0xc67a,
0x48c0, 0xbb, 0xac, 0x0b, 0x5c, 0x6d, 0x66, 0xca, 0xfb );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_ANTIVIRUS, 0xb1d1a169L, 0xc54f,
0x4379, 0x81, 0xdb, 0xbe, 0xe7, 0xd8, 0x8d, 0x74, 0x54 );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_REPLICATION, 0x48d3ebc4L, 0x4cf8,
0x48ff, 0xb8, 0x69, 0x9c, 0x68, 0xad, 0x42, 0xeb, 0x9f );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_CONTINUOUSBACKUP, 0x71aa14f8L,
0x6fad, 0x4622, 0xad, 0x77, 0x92, 0xbb, 0x9d, 0x7e, 0x69, 0x47 );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_CONTENTSCREENER, 0x3e3f0674L,
0xc83c, 0x4558, 0xbb, 0x26, 0x98, 0x20, 0xe1, 0xeb, 0xa5, 0xc5 );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_QUOTAMANAGEMENT, 0x8503c911L,
0xa6c7, 0x4919, 0x8f, 0x79, 0x50, 0x28, 0xf5, 0x86, 0x6b, 0x0c );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_SYSTEMRECOVERY, 0x2db15374L, 0x706e,
0x4131, 0xa0, 0xc7, 0xd7, 0xc7, 0x8e, 0xb0, 0x28, 0x9a );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_CFSMETADATASERVER, 0xcdcf0939L,
0xb75b, 0x4630, 0xbf, 0x76, 0x80, 0xf7, 0xba, 0x65, 0x58, 0x84 );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_HSM, 0xd546500aL, 0x2aeb, 0x45f6,
0x94, 0x82, 0xf4, 0xb1, 0x79, 0x9c, 0x31, 0x77 );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_COMPRESSION, 0xf3586bafL, 0xb5aa,
0x49b5, 0x8d, 0x6c, 0x05, 0x69, 0x28, 0x4c, 0x63, 0x9f );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_ENCRYPTION, 0xa0a701c0L, 0xa511,
0x42ff, 0xaa, 0x6c, 0x06, 0xdc, 0x03, 0x95, 0x57, 0x6f );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_PHYSICALQUOTAMANAGEMENT,
0x6a0a8e78L, 0xbba6, 0x4fc4, 0xa7, 0x09, 0x1e, 0x33, 0xcd, 0x09, 0xd6,
0x7e );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_OPENFILEBACKUP, 0xf8ecafa6L, 0x66d1,
0x41a5, 0x89, 0x9b, 0x66, 0x58, 0x5d, 0x72, 0x16, 0xb7 );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_SECURITYENHANCER, 0xd02bc3daL,
0x0c8e, 0x4945, 0x9b, 0xd5, 0xf1, 0x88, 0x3c, 0x22, 0x6c, 0x8c );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_COPYPROTECTION, 0x89786ff1L, 0x9c12,
0x402f, 0x9c, 0x9e, 0x17, 0x75, 0x3c, 0x7f, 0x43, 0x75 );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_SYSTEM, 0x5d1b9aaaL, 0x01e2, 0x46af,
0x84, 0x9f, 0x27, 0x2b, 0x3f, 0x32, 0x4c, 0x46 );
DEFINE_GUID( GUID_DEVCLASS_FSFILTER_INFRASTRUCTURE, 0xe55fa6f9L, 0x128c,
0x4d04, 0xab, 0xab, 0x63, 0x0c, 0x74, 0xb1, 0x45, 0x3a );

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---


== 2 of 2 ==
Date: Tues, Feb 2 2010 12:41 pm
From: Victor Bazarov


Johnson wrote:
> I am developing a C++ program with Visual Studio 2008. After enableing
> /clr option in the compiler, I [..]

Stop right there. CLR is off-topic. Please find the appropriate
newsgroup in the 'microsoft.public.*' hierarchy. Maybe one with 'vc' in
the name <hint-hint>.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

==============================================================================
TOPIC: Rs 20,000 INR at stake in CodeWarrior
http://groups.google.com/group/comp.lang.c++/t/3a8c7798a693bfcc?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Feb 2 2010 1:21 pm
From: "!!ankit!!"


CodeFest & IEEE present to you CodeWarrior - Either Win or Die Coding!
It is a completely Online event with two cumulative rounds, testing
all aspects of your computer knowledge, be it programming, logical
reasoning, debugging or algorithm design.

There are prizes worth 20,000 INR & Codechef T-Shirts for the winners.

Problem Statements for First Round will be released on Feb 5, 1800 Hrs
(IST). Here is the problem break-up:

* 2 Puzzles
* 2 Algorithm Designing Problems
* 2 C/C++ Debugging Problems
* 1 Algorithm Intensive Programming Challenge

Sample Problems are also available. Sumission Deadline : Feb 14, 2100
Hrs (IST).

It is a team event with maximum of 2 members. So form your team now
and get ready for some baffling puzzles, buggy codes & bewildering
algorithms.

For further questions email us at codefest@itbhu.ac.in or contact the
following:

Shishir Mittal: +91-9936-180-121 shishir.mittal.cse06@itbhu.ac.in

Other Events at Codefest

* GumboRumble : Problem statements for Adobe sponsored 2 months
long application development competition with prizes worth 50,000
INR, have been released. Registrations and Submissions closes on Feb
24 2100 Hrs (IST).
* MathMania : An event with Challenging Mathematical Problems as
in Project Euler, Scheduled on Mar 13.
* Manthan : An algorithm intensive programming competition on the
lines of ACM-ICPC, to be hosted on Codechef. Scheduled on Mar 14.
* Perplexed! : C obscure Programming Competition, to get in-depth
knowledge of C. Scheduled on Mar 21.

Be free and Happy Coding!

Team Codefest.
Website: http://itbhu.ac.in/codefest
Twitter: http://twitter.com/c0defest
Blog: http://codefest.wordpress.com


== 2 of 2 ==
Date: Tues, Feb 2 2010 4:43 pm
From: jamm


!!ankit!! wrote:

> CodeFest & IEEE present to you CodeWarrior - Either Win or Die Coding!

Will 20000 INR make me rich? Or is it more like a peso kinda thing.

--
*From the 1966 TV series:*
Robin: You can't get away from Batman that easy!
Batman: Easily.
Robin: Easily.
Batman: Good grammar is essential, Robin.

==============================================================================
TOPIC: On the Square-Rectangle Problem
http://groups.google.com/group/comp.lang.c++/t/17378f3e6e3294ba?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Feb 2 2010 3:18 pm
From: Philip Potter


On 01/02/2010 16:23, Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>> It has been solved by me some years ago - I don't know if
>> anyone else has published this solution, but I guess so:
>
> I have been looking around and found:
>
> http://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)
>
> Using the terms from this article, I can define a function:
>
> *: T -> T*
>
> that maps a type T of values to a type T* of storage cells
> for such values, and the essential assertion then becomes:
>
> * is contravariant.
>
> That is, using »<=« from this article:
>
> square <= rectangle, but
> rectangle* <= square*.

I agree that a square value is a rectangle value.
I don't agree that a rectangle store is a square store.

Everything that I can say about a rectangle value also applies to square
values, but I can come up with properties about a square store that do
not apply to a rectangle store. In particular:

A square store is guaranteed to hold a square. A rectangle store has no
such guarantee.

A rectangle store which currently holds a nonsquare rectangle is
certainly not useful as a square store.

Therefore, at this level of abstraction, Liskov substitutability is not
satisfied. I can see that perhaps, if you introduce some more conditions
or clarifications, a rectangle store might be considered to be a square
store, but right now neither seems to be an example of the other.

Phil

==============================================================================
TOPIC: memory leaks
http://groups.google.com/group/comp.lang.c++/t/d9b20823062f2cb3?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Feb 2 2010 4:12 pm
From: Jorgen Grahn


On Wed, 2010-01-27, Christian Hackl wrote:
> Larry ha scritto:
>
>> well, I could have done with vectors indeed. Yet, I thought becauese of all
>> those internal checks vector does maybe my solution would have been
>> faster...
>
> You must not guess but measure.
>
> It is unlikely that you will notice any difference in speed.

Yes. And also, *which* "all those internal checks"? People usually
complain about the *lack* of checks in the standard containers, e.g.
range checks.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .


== 2 of 2 ==
Date: Tues, Feb 2 2010 4:24 pm
From: Jorgen Grahn


On Mon, 2010-01-25, Larry wrote:
...
> #define _CRT_SECURE_NO_WARNINGS
> #include <windows.h>
> #include <vector>
> #include <cstdlib>
> #include <ctime>
> #include <cstdio>
> #include <boost/circular_buffer.hpp>
> using namespace std;
> using namespace boost;

...
> ZeroMemory(buff, sizeof(Buffer));

Just out of curiosity: did you define this one somewhere, or are
Microsoft daft enough to push a differently named std::memset()?

(Or bzero(), although that one is just traditional).

More helpfully, in the rare case that I have to manually initialize
buffers like this, I use std::fill and friends. The old C functions
which operate on raw memory (memset, memcpy etc) doesn't play nice with
C++ objects, which in turn can lead to nasty bugs.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

==============================================================================
TOPIC: Another strange linux kernel change
http://groups.google.com/group/comp.lang.c++/t/e05a4158a9750a03?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Feb 2 2010 4:26 pm
From: Jorgen Grahn


On Fri, 2010-01-29, Man-wai Chang to The Door (24000bps) wrote:
>
> i++ --> ++i, on a separate line! Does it matter?

Last time I checked, Linux was written in C. This is comp.lang.c++.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

==============================================================================
TOPIC: Looking for C++ IDE,...
http://groups.google.com/group/comp.lang.c++/t/e8a1db0949215858?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Feb 2 2010 4:34 pm
From: Jorgen Grahn


On Mon, 2010-02-01, John Koy wrote:
> Kerem G�mr�kc� wrote:
>> Hi,
>>
>> i am looking fo a (free, non-microsoft!) C++ IDE for windows, that
>> can do most of the MSVC++ stuff (resources, projects, etc.) but most
>> important is the abillity to easily switch between processor targets
>> for the compiler/linker e.g. it should have a 32 and 64 bit compiler
>> included in the environment and 64 bit code can be compiled on
>> a 32 bit system. I want to target Windows only (windows api is the
>> foundation or will be), so there is no need to use a mixed environment.
>
> The only feasible option for you is Visual Studio, no need to become a
> dreamer. Besides, Windows API is C-based. It doesn't mean you cannot
> develop C++ software using a C API, but it's not practical.

Huh? I spend my days doing C++ programming on Unix, which only has a
C API. It's definitely practical.

And come to think of it, Windows' MFC is a C++ API. (A dreaded one,
but still ...)

> Actually, I doubt you want to develop with C++, it all sounds like you
> really are using C.

Seriously? You have no information to support that.

Or maybe you are simply trolling ...

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .

==============================================================================
TOPIC: C++0x regex supported by gcc?
http://groups.google.com/group/comp.lang.c++/t/a5e3fb25be9236a9?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Feb 2 2010 4:58 pm
From: Jorgen Grahn


On Sun, 2010-01-31, mattia wrote:
> Hi all, do you know if gcc supports the regex library defined in the
> C++0x draft? If so, which version?

This ought to be a starting point:
http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html

> Can you provide a simple snippet?

Example code? Why? Using the regex library will look the same, no
matter what compiler you use, as long as it supports it.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.c++"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.c++?hl=en

To unsubscribe from this group, send email to comp.lang.c+++unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.c++/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

No comments: