This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/22397] New: Extension to initialize enum using pointers to const strings.
- From: "rjshaw at netspace dot net dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jul 2005 01:43:32 -0000
- Subject: [Bug c/22397] New: Extension to initialize enum using pointers to const strings.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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