Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: why is gcc telling me my for loop is wrong

  1. #11
    Join Date
    Apr 2007
    Beans
    14,781

    Re: why is gcc telling me my for loop is wrong

    Quote Originally Posted by jimi_hendrix View Post
    thanks...i have to stop coding past 9 pm...
    Only 9 pm? Why, I've stayed up all night, into sunrise coding. This is usually a bad idea though, only code when you are fully awake and fueled by things other than adrenaline and mountain dew.

  2. #12
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: why is gcc telling me my for loop is wrong

    Quote Originally Posted by jimi_hendrix View Post
    now about that indenting thing...is there auto indenting in vim or are there lightweight editors with it?
    The vim installed by default is a minimal version, without syntax highlighting and indenting. Install apt://vim-full to get the full featured vim. Then, edit /etc/vim/vimrc, it has comments explaining what options will give you auto indenting.

  3. #13
    Join Date
    Apr 2007
    Beans
    14,781

    Re: why is gcc telling me my for loop is wrong

    Quote Originally Posted by geirha View Post
    The vim installed by default is a minimal version, without syntax highlighting and indenting. Install apt://vim-full to get the full featured vim. Then, edit /etc/vim/vimrc, it has comments explaining what options will give you auto indenting.
    Or just vim. vim-full has silly stuff.

  4. #14
    Join Date
    Oct 2008
    Location
    White House
    Beans
    361

    Re: why is gcc telling me my for loop is wrong

    Quote Originally Posted by LaRoza View Post
    Yes, there is.

    It does, but by default, it uses the most common version. You will have to specific the standard to use.

    Code:
    man gcc | grep "c99"
    Also because c99 isn't fully supported yet. IMHO it makes sense making them default only after all specifications from c99 get implemented, and looks like the gcc devs think the same way. It will be default anyway, it's just a matter of time.

  5. #15
    Join Date
    Mar 2008
    Location
    Denmark
    Beans
    134
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: why is gcc telling me my for loop is wrong

    Quote Originally Posted by Phenax View Post
    There are an infinite number of primes below the number two. That code makes your program return incorrect solutions. Perhaps you mean return true;. All numbers below two are prime, not composite.
    There is no primes less than 2.

    Quoting wikipedia:
    In mathematics, a prime number (or a prime) is a natural number which has exactly two distinct natural number divisors: 1 and itself.
    Last edited by achelis; November 10th, 2008 at 04:11 PM.

  6. #16
    Join Date
    Apr 2007
    Location
    (X,Y,Z) = (0,0,0)
    Beans
    3,715

    Re: why is gcc telling me my for loop is wrong

    Quote Originally Posted by jimi_hendrix View Post
    why doesnt gcc use the newest version of C?
    As other have said, gcc supports C99, but you have to use the --std=c99 flag for that.

    But this is not just gcc, IIRC almost all compilers do this, just because C99 is not a widespread standard. The ANSI and the ISO bodies can declare standards on their will, but can't make people adopt them...

    The same occurs with the W3 Consortium... yeah, there's the HTML 4.01 standard and XHTML 1.1... but how many webpages follow them? Worse, how many browsers comply with them?

  7. #17
    Join Date
    Apr 2007
    Beans
    14,781

    Re: why is gcc telling me my for loop is wrong

    Quote Originally Posted by nvteighen View Post
    The ANSI and the ISO bodies can declare standards on their will, but can't make people adopt them...
    Au contraire, Microsoft can make ISO declare standards, and make people adopt them (but, the adoption is different from the standard...)

  8. #18
    Join Date
    Jul 2008
    Beans
    1,706

    Re: why is gcc telling me my for loop is wrong

    Quote Originally Posted by LaRoza View Post
    Only 9 pm? Why, I've stayed up all night, into sunrise coding. This is usually a bad idea though, only code when you are fully awake and fueled by things other than adrenaline and mountain dew.
    ya but the quality of my questions drops serverly after 9:00

  9. #19
    Join Date
    Apr 2007
    Beans
    14,781

    Re: why is gcc telling me my for loop is wrong

    Quote Originally Posted by jimi_hendrix View Post
    ya but the quality of my questions drops serverly after 9:00
    The quality of my code drops...

    (Time varies, as my obligations change, so "late" is quite relative)

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •