C99 and Angband?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CJNyfalt
    Swordsman
    • May 2007
    • 289

    C99 and Angband?

    I have noticed that the latest development Angband code uses C99 features.

    Now, I like the new features available in C99, but how common are compilers that support them? Does C++ compilers in general support C99 features?
  • Psi
    Knight
    • Apr 2007
    • 870

    #2
    The free WinCE 4.0 compiler certainly doesn't - can't comment on Visual Studio.

    Comment

    • takkaria
      Veteran
      • Apr 2007
      • 1951

      #3
      Originally posted by CJNyfalt
      I have noticed that the latest development Angband code uses C99 features.

      Now, I like the new features available in C99, but how common are compilers that support them? Does C++ compilers in general support C99 features?
      The current code should not (it did for a while, though). All code in the trunk should compile under an ISO C89 mode. We do make use of various useful C99 headers if they're around, though, for guaranteed type sizes and the like.
      takkaria whispers something about options. -more-

      Comment

      • CJNyfalt
        Swordsman
        • May 2007
        • 289

        #4
        Originally posted by takkaria
        The current code should not (it did for a while, though). All code in the trunk should compile under an ISO C89 mode. We do make use of various useful C99 headers if they're around, though, for guaranteed type sizes and the like.
        It's not as much that I'm worried that it won't compile, and more about if it's safe to add new features from C99 in other places.
        For example, z-form still needs sprintf, which is unsafe, under C89,
        but C99 should have snprintf which is safer from buffer overflows.
        If there's need to jump through hoops and add a big mess of ifdefs, then I would avoid C99 for the time being.

        Comment

        • takkaria
          Veteran
          • Apr 2007
          • 1951

          #5
          Originally posted by CJNyfalt
          It's not as much that I'm worried that it won't compile, and more about if it's safe to add new features from C99 in other places.
          For example, z-form still needs sprintf, which is unsafe, under C89,
          but C99 should have snprintf which is safer from buffer overflows.
          If there's need to jump through hoops and add a big mess of ifdefs, then I would avoid C99 for the time being.
          I was planning to replace to use of sprintf with a builtin version, myself, to avoid using it.

          There's a page with the current coding guidelines, BTW, in case you're interested:
          takkaria whispers something about options. -more-

          Comment

          Working...
          😀
          😂
          🥰
          😘
          🤢
          😎
          😞
          😡
          👍
          👎