PennMUSH Community

Ticket #7324 (closed general discussion: fixed)

Opened 2 years ago

Last modified 2 years ago

// comments

Reported by: raevnos Assigned to: devteam
Priority: minor Milestone:
Keywords: Cc:
Visibility: Public

Description

A few places where // were used have crept into the source, and have been since at least the previous set of releases.

The rule of thumb for code is to write for the C89 standard, + C99 and compiler-specific additions that can easily be tested for and defined out or otherwise worked around if not supported by a particular compiler (restrict, all the GCC attribute stuff, etc...) or standard library.

BCPL-style comments aren't that. On the other hand, nobody's reported any problems compiling because of them. On the gripping hand, I suspect that 99.999% of Penns are compiled using gcc or one of the MS compilers -- a reason why we use so many of those compiler's extensions and hints.

I'm not sure if I should convert the offending comments to /**/ ones, or leave be until it becomes an issue. Comments?

Change History

05/14/07 05:33:36 changed by Alan Schwartz

Quoting Penndev (pennmush-bugs@pennmush.org):
> #7324: // comments
> -------------------------------+--------------------------------------------
> Reporter:  raevnos             |        Owner:  devteam
>     Type:  general discussion  |       Status:  new    
> Priority:  minor               |    Milestone:         
> Keywords:                      |   Visibility:  Public 
> -------------------------------+--------------------------------------------
>  A few places where // were used have crept into the source, and have been
>  since at least the previous set of releases.
> 
>  The rule of thumb for code is to write for the C89 standard, + C99 and
>  compiler-specific additions that can easily be tested for and defined out
>  or otherwise worked around if not supported by a particular compiler
>  (restrict, all the GCC __attribute__ stuff, etc...) or standard library.
> 
>  BCPL-style comments aren't that. On the other hand, nobody's reported any
>  problems compiling because of them. On the gripping hand, I suspect that
>  99.999% of Penns are compiled using gcc or one of the MS compilers -- a
>  reason why we use so many of those compiler's extensions and hints.
> 
>  I'm not sure if I should convert the offending comments to /**/ ones, or
>  leave be until it becomes an issue. Comments?

Convert. It's easy, and discourages further use of them.

-- 
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Javelin@M*U*S*H, once Paul@DuneMUSH | Alan Schwartz <dunemush@pennmush.org>
   (mush.pennmush.org 4201)         |     
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

(follow-up: ↓ 3 ) 05/14/07 18:12:31 changed by vinzaara

As I recalled, // was in the C99 standard. Double checking the Wiki, Wiki C99, for reference, and it was specified there. So at this point, I would think that any compiler should have itself up to standards for C99.

At this point, the question should probably be a decision whether the C99 standard should be the new base instead of just checking for existing features of it.

(in reply to: ↑ 2 ) 05/15/07 00:56:03 changed by raevnos

Replying to vinzaara:

As I recalled, // was in the C99 standard.

We use C89 because despite the 8 years that have passed since the latest version of the language, certain compiler vendors (I'm looking at you, big big big company headquartered in Redmond!) have yet to add any support to speak of for C99's additions to their products. // comments and maybe (I don't have a way of testing this) being able to declare variables wherever instead of just at the start of a block are about it for Visual Foo.

Which is a shame, because I'd love to be able to use things like designated initializers and compound literals. See utils/gentables.c for an example.

05/15/07 11:42:19 changed by raevnos

  • status changed from new to closed.
  • resolution set to fixed.

Converted // comments and fixed some other warnings found with -pedantic.