c++ - Wrong warning (18)
- Adder (20/20) Apr 06 2006 Hello,
- Walter Bright (6/34) Apr 06 2006 An easier way to turn off the warning is to rewrite as:
- Adder (4/9) Apr 06 2006 True...
-
Walter Bright
(3/5)
Apr 06 2006
That's why I hate warnings
.
Hello, The following code: int f () { throw 10; } int main () { return 0; } produces: Warning 18: implied return of f at closing '}' does not return value Can you please provide a way to disable warnings via #pragma's and push/pop these settings so that warnings are disabled only for some sections of the code ? I wouldn't like to turn off this warning for the entire code. (For example, with Borland, one can write: #pragma option push #pragma warn-par .. #pragma option pop ) Thanks, Adder
Apr 06 2006
Adder wrote:Hello, The following code: int f () { throw 10; } int main () { return 0; } produces: Warning 18: implied return of f at closing '}' does not return value Can you please provide a way to disable warnings via #pragma's and push/pop these settings so that warnings are disabled only for some sections of the code ? I wouldn't like to turn off this warning for the entire code. (For example, with Borland, one can write: #pragma option push #pragma warn-par .. #pragma option pop )An easier way to turn off the warning is to rewrite as: int f() { throw 10; return 0; }
Apr 06 2006
An easier way to turn off the warning is to rewrite as: int f() { throw 10; return 0; }True... But then the other compiler complains about "Unreachable code in function f" :D However, that can be solved by disabling the warning. For the other compiler. Thanks !
Apr 06 2006
Adder wrote:...An easier way to turn off the warning is to rewrite as:But then the other compiler complains about "Unreachable code in function f" :DThat's why I hate warnings <g>.
Apr 06 2006