This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/22397] New: Extension to initialize enum using pointers to const strings.


I should be able to cast a const string pointer to an int so that
one could do:

  enum {hash = (int)"the first enum"}.

It's cleaner than #defines and easier to debug.

The reason that it's useful is so that one can use the enum values anywhere, and
be guaranteed to get the same value, unlike using a #defined string everywhere,
where the resulting pointer value may be different if the same string value gets
stored in multiple places.

-- 
           Summary: Extension to initialize enum using pointers to const
                    strings.
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rjshaw at netspace dot net dot au
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: debian-sid x86


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22397


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]