Whoops, sorry, see below:
-------------- Build: Debug in b ---------------
mingw32-g++.exe -Wall -Wshadow -Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline...
Type: Posts; User: Vespasian
Whoops, sorry, see below:
-------------- Build: Debug in b ---------------
mingw32-g++.exe -Wall -Wshadow -Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline...
I think you're onto something here and its your last return statement.
Let me explain to everyone if this makes sense.
I cleaned the code up until there were no warnings left or atleast there...
Cant copy results effectively, I hope a screen tag will do?
13318
Also, I cannot seem to get the warning fields jblumberg gets. I like the -Wtype-limits and -Wreturn-type. I dont get these...
EDIT: It seems to show the warnings now i.e. only when I deliberately insert a compiler error like a simple syntax error. Then all warnings show. Otherwise if there are no compiler errors then it...
Pretty much the same as the opening code, here it is again (I havent yet corrected the illogical if statement as you have suggested, still need to do that):
#include <iostream>
#include...
Did all that. Enabled all warnings as screen shot above. Did it for both the project and for global. Did it for both the debug and the release. Looking at the build log and all other logs.
No...
Hi Jim, as shown below
13311
13312
Im using it on windows and I go to compiler settings and Im trying to switch on enable warnings.
Anybody here using code::blocks? I switched warnings to the max or atleast so I think I did.
I tried this. And whilst it still compiles, the error is still there. With all due respect, are my funny results coming from these warnings or are they just a side note?
My compiler seemed to have ignored those even though, if you saw, on my previous comment at the end of tha last page that I said I switched it on. PS: Please repaste the code I posted above, I made a...
As requested. and YES I UNDERSTAND "IM USING MALLOC and wrong practice blah blah blah" but honestly can we please keep the criticism constructive pertaining to the error itself.
#include...
But this cant be the case because I ran the debugger step by step, and the last step the debugger ran was line 26 indeed proving it exited the function at line 26. It never so much as sniffed line 41...
Okay then, I'm going to look at
*wordptr != 'EOF'
more carefully and see what I come up with...
The point I am making is that I find it surprising that although C/C++ is a strictly...
But it cant get to the end because between line 14 and line 41 is line 26. The conditions leading up to line 26 are all satisfied and the return 3 statement is executed. I even checked with debugging...
You are correct in spotting this but it doesnt affect the code.
Nope. The output is a mere integer and returns directly as an integer.
UPDATE: I only commented out line 41 and it returns...
EDIT: Title of thread should read "Return statement affected by other return statements"
Hi all, I have a piece of code that resembles the following:
int locomotives_required (double...
Both solutions work. Thanks.
I agree with this. However I come from a C learning background and so I am very slowly tapering to C++ and hence my code tends to have a hybrid approach for now. I am aiming for more C++ orientated...
I have the following code:
while (lineread != "\n")
{
getline(ifs,lineread);
}
In essence, it reads an input file, line by line until it...
Excellent find!
I was just about to post a new thread asking why the tokenizer function returns a SIGSEGV error. So then I did:
char* tokenizer (string inputstream)
{
char* cstringcpy;...
Okay I made a copy and it worked:
// A simple tokenizer
string lineread = "Hello how are you"
const char* cstr = lineread.c_str();
char* cstringcpy = NULL;
strcpy(cstringcpy,cstr);...
Okay I added a const but the following code gives the same error on line 4:
// A simple tokenizer
string lineread = "Hello how are you"
const char* cstr = lineread.c_str();
char* wordptr...
string lineread = "Hello"
char* cstr = lineread.c_str();
Gives an error invalid conversion from 'const char*' to 'char*' [-fpermissive]
I understand this has something to do with immutable vs...
Hi guys,
I kept it as 2.25/1.5 and still got 2 and 0. But I realized that the widget box (Im using a GUI and not console) only displays positive numbers and hence did not display a remainder of...