[Freeciv-tickets] [freeciv] #43826: CodingStyle: compound literals

Back to archive index
OSDN Ticket System norep****@osdn*****
Mon Feb 14 01:52:20 JST 2022


#43826: CodingStyle: compound literals

  Open Date: 2022-02-08 17:20
Last Update: 2022-02-13 17:52

URL for this Ticket:
    https://osdn.net//projects/freeciv/ticket/43826
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=43826

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2022-02-13 17:52 Updated by: alienvalkyrie

Comment:

Reply To cazfi
I still don't know if latest version of Visual Studio supports them or not.
Apparently, based on answers I got from people I asked, the Microsoft Visual C++ compiler supports compound literals in C mode since MSVC 2013 (source). (It does not seem to support compound literals in C++ mode.)
So that sounds like a "yes", assuming the distinction between "C mode" and "C++ mode" doesn't need to happen on a project level, but on a compilation unit level.
Whether that's relevant is another question.
I'd argue that when push comes to shove, code readability should be considered more important than compatibility with a proprietary development environment. There would certainly be upsides to supporting VS, but I don't think they're greater than the upsides of being able to declare and initialize a struct that's only used in one place in the place it's used.

---------------------------------------------------------------------
Ticket Status:

      Reporter: alienvalkyrie
         Owner: (None)
          Type: Patches
        Status: Open
      Priority: 5 - Medium
     MileStone: 3.1.0
     Component: Documentation
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

Continued from #43809.
Compound literals (which look similar to struct/unition initializers) are currently only used in very few places (most prominently, the requirement_fulfilled_by_* macros in common/requirements.h). We need to figure out / decide if and how we generally want to use them, and add that information to doc/CodingStyle.

-- 
Ticket information of Freeciv project
Freeciv Project is hosted on OSDN

Project URL: https://osdn.net/projects/freeciv/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net/projects/freeciv/ticket/43826
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=12505&tid=43826



More information about the Freeciv-tickets mailing list
Back to archive index