🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Michael T Pope Fri, 27 Oct 1989 04:14
More unnecessary(?) warnings
#548
Author: Michael T Pope
Date: Fri, 27 Oct 1989 04:14
44 lines
1892 bytes
Here are some more seemingly unnecessary warnings.
-----------------foo.C-------------
class foo {
private:
  int dummy;
public:
  foo() {}
}; // foo

typedef foo* foo_p;

extern void frob1(const foo_p);
extern void frob2(const foo*);

class bar : public foo {
public:
  bar() {}
  void borf() const {
    frob1(this);        // warning
    frob1((foo*) this); // no warning
    frob1(foo_p(this)); // no warning
    frob2(this);        // no warning
    frob2((foo*) this); // no warning
    frob2(foo_p(this)); // no warning
  }
}; // bar

const bar b;
const foo_p f1 = &b;        // warning
const foo_p f2 = (foo*) &b; // no warning
const foo_p f3 = foo_p(&b); // no warning
----------------------------------------
59 Crackle> g++ -v -c -Wall foo.C
gcc version 1.36.0- (based on GCC 1.36)
 /usr/local/gnu/gcc-cpp -+ -v -undef -D__GNUC__ -D__GNUG__ -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -Wall foo.C /usr/tmp/cca18327.cpp
GNU CPP version 1.36
 /usr/local/gnu/gcc-cc1plus /usr/tmp/cca18327.cpp -quiet -dumpbase foo.C -Wall -version -o /usr/tmp/cca18327.s
GNU C++ version 1.36.0- (based on GCC 1.36) (sparc) compiled by GNU C version 1.36.
default target switches: -mfpu -mepilogue -msun-asm
foo.C: In method void bar::borf ()const :
foo.C:17: warning: argument passing of non-const * pointer from const *
foo.C: At top level:
foo.C:27: warning: initialization of non-const * pointer from const *
...(other sensible warnings about unused variables)...
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads