www.digitalmars.com         C & C++   DMDScript  

c++ - DM8.23

reply Roland <rv ronetech.com> writes:
Not a problem, just for information:

//header

MyClass {
public:
    .
    void useMyFunction(..);
    int myFunction();
    .
};

//-----------------
//CPP

    void MyClass::useMyFunction() {
        .
        if (myFunction) {           //<--------  i forgot to put the
parenthesis after myFunction and it compiles with DM823: is it normal ?
            .
        }
        .
}

I must signal that i just realize that myFunction never uses *this
pointer and could be static.
command line: sc .. -r -mx -o+time -5 -a4 -c ..
    .

Roland
    .
Nov 30 2001
next sibling parent Damian <damiandixon netscape.net> writes:
Roland,

I suspect the compiler should give an error...

I tried the code on HP's compiler 'aCC' and got the following error:

# Nonstatic member function "int MyClass::myFunction()" is used 
incorrectly (must be either called or used to form a pointer to member).

Regards,
Damian

Roland wrote:

 Not a problem, just for information:
 
 //header
 
 MyClass {
 public:
     .
     void useMyFunction(..);
     int myFunction();
     .
 };
 
 //-----------------
 //CPP
 
     void MyClass::useMyFunction() {
         .
         if (myFunction) {           //<--------  i forgot to put the
 parenthesis after myFunction and it compiles with DM823: is it normal ?
             .
         }
         .
 }
 
 I must signal that i just realize that myFunction never uses *this
 pointer and could be static.
 command line: sc .. -r -mx -o+time -5 -a4 -c ..
     .
 
 Roland
     .
 
 

Nov 30 2001
prev sibling parent "Walter" <walter digitalmars.com> writes:
It's interpreted as a pointer to a member function. -Walter

"Roland" <rv ronetech.com> wrote in message
news:3C076D27.3799691F ronetech.com...
 Not a problem, just for information:

 file://header

 MyClass {
 public:
     .
     void useMyFunction(..);
     int myFunction();
     .
 };

 file://-----------------
 file://CPP

     void MyClass::useMyFunction() {
         .
         if (myFunction) {           file://<--------  i forgot to put the
 parenthesis after myFunction and it compiles with DM823: is it normal ?
             .
         }
         .
 }

 I must signal that i just realize that myFunction never uses *this
 pointer and could be static.
 command line: sc .. -r -mx -o+time -5 -a4 -c ..
     .

 Roland
     .

Nov 30 2001