how to avoid some C++ bugs!

how to avoid some C++ bugs!

Post by Edmund Humenberge » Tue, 13 May 1997 04:00:00



ewsletter
The following quote comes from Mani Varadarajan, core developer at BE.

"Rule: Don't declare member variables of classes static, if the
      member variable is of a nonfundamental type."

see the full story at

http://www.be.com/aboutbe/benewsletter/Issue72.html

Yours ed

 
 
 

1. Serious bug in Solaris C++ (SC4.0 18 Oct 1995 C++ 4.1)

Greetinx earthlings,

When compiling the following code using Solaris SC4.0 I get the following
output:

123
1
123

Not what you would expect.....

#include <iostream.h>

struct t_bug {
   int a;
   int b;
   int c;

class Buggy
{
   public:
      void bugIt(int b = 1) { struct t_bug bug = { 1, b, 3 };
                              cout << bug.b << endl ;
                            }
      void bugItAgain(int b);

void Buggy::bugItAgain( int b = 1 )
{
   struct t_bug bug = { 1, b, 3 };
   cout << bug.b << endl ;

void bugIt(int b = 1)
{
   struct t_bug bug = { 1, b, 3 };
   cout << bug.b << endl;

int main (void)
{
   Buggy b;
   bugIt( 123 );
   b.bugIt( 123 );
   b.bugItAgain( 123 );
   return 0;

Wha'ya think?

2. logitech mouseman wheel and F1 on the thumb button

3. AVOID* Computers Ur Way * AVOID

4. dir size

5. Bug: Dynamic Linking and global C++ objects

6. xcdplayer

7. C++ code bug: different result under Solaris and Linux???

8. scsi: aic7xxx & tagged queuing

9. SCO Unixware C++ compiler bug with threads?

10. Sun C++ 4.0 bug with member function taking char *[]

11. HP C++ Compiler and possible bug?

12. Bug in SunPro C++ compiler? Work-around?

13. C++ bugs