Search:

Type: Posts; User: Vespasian

Page 1 of 8 1 2 3 4

Search: Search took 0.01 seconds.

  1. Whoops, sorry, see below: --------------...

    Whoops, sorry, see below:



    -------------- Build: Debug in b ---------------

    mingw32-g++.exe -Wall -Wshadow -Winit-self -Wredundant-decls -Wcast-align -Wundef -Wfloat-equal -Winline...
  2. I think you're onto something here and its your...

    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...
  3. Cant copy results effectively, I hope a screen...

    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...
  4. EDIT: It seems to show the warnings now i.e. only...

    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...
  5. Pretty much the same as the opening code, here 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...
  6. Did all that. Enabled all warnings as screen shot...

    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...
  7. Hi Jim, as shown below 13311 13312

    Hi Jim, as shown below

    13311

    13312
  8. Im using it on windows and I go to compiler...

    Im using it on windows and I go to compiler settings and Im trying to switch on enable warnings.
  9. Anybody here using code::blocks? I switched...

    Anybody here using code::blocks? I switched warnings to the max or atleast so I think I did.
  10. I tried this. And whilst it still compiles, the...

    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?
  11. My compiler seemed to have ignored those even...

    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...
  12. As requested. and YES I UNDERSTAND "IM USING...

    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...
  13. But this cant be the case because I ran the...

    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...
  14. Okay then, I'm going to look at *wordptr !=...

    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...
  15. But it cant get to the end because between line...

    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...
  16. You are correct in spotting this but it doesnt...

    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...
  17. Return statement is NOT exiting the function!!!

    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...
  18. Both solutions work. Thanks.

    Both solutions work. Thanks.
  19. Replies
    18
    Views
    2,064

    I agree with this. However I come from a C...

    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...
  20. Newline character not being picked up in a conditional statement

    I have the following code:


    while (lineread != "\n")
    {
    getline(ifs,lineread);
    }

    In essence, it reads an input file, line by line until it...
  21. Replies
    18
    Views
    2,064

    Excellent find! I was just about to post a new...

    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;...
  22. Replies
    18
    Views
    2,064

    Okay I made a copy and it worked: // A...

    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);...
  23. Replies
    18
    Views
    2,064

    Okay I added a const but the following code gives...

    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...
  24. Replies
    18
    Views
    2,064

    Converting C++ string to C style string

    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...
  25. Hi guys, I kept it as 2.25/1.5 and still got 2...

    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...
Results 1 to 25 of 183
Page 1 of 8 1 2 3 4