I am using C++ compiler GCC 4.2 in XCode 3.2.2. I have noted that the compiler will successfully compile a method foo even though there are no ellipses. The header and method are properly declared as foo(), but when I do a find and replace either by file or by program-wide it will miss approximately 2-3% of the changes [foo to foo(). This would not be critical if the compiler did not give an erroneous successful build. I have not found that this to occur with: foo(any parameter). Does anyone have any solution? Thank you.
views:
49answers:
2
+2
A:
It's unclear from your question what you are actually asking about, but if it is function calls then:
void foo() {
}
int main() {
foo(); // valid C++ - call foo
foo; // valid C++ - get a function pointer
}
If you want a warning about the second use of foo, compile with the GCC -Wall
flag (which you should really be using all the time in any case) - this will give you:
f.cpp:6: warning: statement is a reference, not call, to function 'foo'
f.cpp:6: warning: statement has no effect
anon
2010-05-22 08:04:56
A:
To add a GCC flag through xcode:
- Go to the "Project" menu and select "Edit Project Settings"
- Select the "Build" tab
- Find the "Other C++ Flags" setting and double click on the blank space to the right
- Click the plus sign and add "-Wall"
AdamG
2010-05-24 02:27:47