#16 liblicense.0.4 - gcc -ansi

closed-accepted
liblicense (10)
5
2007-08-29
2007-08-26
No

This change set increases the portability of the C code - to compilers other than GCC - by avoiding post-1989 features of the C language definition. Yes: 18 years later and they STILL haven't caught up.

I haven't committed this to my repo yet, I'd like to know what folks think.

Personally, I'd rather be coding in C++, where mixed declarations and statements are OK. They make a lot of sense. Problem is that most compilers except GCC are, well, behind the times.

The no-c++ comments thing is important programmer psychology. It provides the reader with an almost subliminal clue that they are dealing with C, and not anything else.

Discussion

  • Scott Shawcroft

    Scott Shawcroft - 2007-08-26
    • assigned_to: nobody --> tannewt
     
  • Scott Shawcroft

    Scott Shawcroft - 2007-08-28

    Logged In: YES
    user_id=1634298
    Originator: NO

    Looks good. Compiler portability is not something I've dealt with so I'll take your word for it. Shall I commit it?

     
  • Jon Phillips

    Jon Phillips - 2007-08-28

    Logged In: YES
    user_id=914868
    Originator: NO

    Go for it...pmiller can commit to!

     
  • Jason Kivlighn

    Jason Kivlighn - 2007-08-28

    Logged In: YES
    user_id=1625120
    Originator: NO

    Getting rid of c++ comments is a clear OK. Getting rid of mixed declarations and statements couldn't hurt (although I agree, it's lame and annoying that there are still compilers out there that haven't gotten their act together).

    I'm unsure of using alloca(). I'm not all that familiar with it, but it sounds like it's discouraged and has many buggy implementations. I'd prefer to use malloc() instead. ll_new_license_chooser is typically only called once during the entire session, so we're not looking at a significant performance hit allocating on the heap verses the stack.

     
  • Peter Miller

    Peter Miller - 2007-08-28

    Logged In: YES
    user_id=160
    Originator: YES

    sf.net has it still assigned to you, scott.
    please commit the patch, if you agree that I can fix the alloca in another change set (soon!)

     
  • Jason Kivlighn

    Jason Kivlighn - 2007-08-28

    Logged In: YES
    user_id=1625120
    Originator: NO

    I see a bug in flat_file.c. If fgets() doesn't read anything, tmp should explicitly be set to NULL (or is it the empty string (Scott?)). Otherwise, tmp remains uninitialized and we return jibberish. The file will be empty when the default license has been unset.

     
  • Peter Miller

    Peter Miller - 2007-08-29

    Logged In: YES
    user_id=160
    Originator: YES

    sf.net has it still assigned to you, scott.
    please commit the patch, if you agree that I can fix the alloca in another change set (soon!)

     
  • Peter Miller

    Peter Miller - 2007-08-29

    Logged In: YES
    user_id=160
    Originator: YES

    Attached is a new improved patch. It gets rid of alloca, and it fixes the flat_file.c problem.
    File Added: liblicense.0.4.c24.patch.txt

     
  • Peter Miller

    Peter Miller - 2007-08-29

    Logged In: YES
    user_id=160
    Originator: YES

    committed to svn, rev 6989

     
  • Peter Miller

    Peter Miller - 2007-08-29
    • assigned_to: tannewt --> pmiller
    • status: open --> closed-accepted
     

Log in to post a comment.