← Back to team overview

linux-traipu team mailing list archive

[Bug 621861] Re: convert structs to classes

 

In c++, structs *are* classes.  The only difference between the keywords
is that "struct" declares a class that is by default public, where
"class" declares a class that is by default private. They share the same
namespace even -- the elaborated-type-specifiers mechanism doesn't
apply; they're literally classes.

I have Stroustrup in front of me, 12th printing (May 2005), and on page
234, section 10.2.8, it quoth:


  By definition, a struct is a class in which members are by default public; that is,

    struct s { . . .

  is simple shorthand for

    class s { public: . . .


And this short c++ snippet fails to compile with an actually pretty good error message showing this to be the case:

  zanfur@gandalf:~$ cat foo.cpp
  class  foo { int bar; };
  struct foo { int bar; };
  zanfur@gandalf:~$ g++ foo.cpp
  foo.cpp:2: error: redefinition of ‘struct foo’
  foo.cpp:1: error: previous definition of ‘struct foo’

I don't see that this bug is valid, at least as written.

-- 
You received this bug notification because you are a member of UBUNTU -
AL - BR, which is subscribed to Drizzle.
https://bugs.launchpad.net/bugs/621861

Title:
  convert structs to classes

Status in A Lightweight SQL Database for Cloud Infrastructure and Web Applications:
  Triaged

Bug description:
  Drizzle is c++ ... plan structs in the code should be converted to be
  proper classes.

To manage notifications about this bug go to:
https://bugs.launchpad.net/drizzle/+bug/621861/+subscriptions