public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/45168]  New: There should be a way to mark specific enum members as deprecated
@ 2010-08-02 21:33 joseph dot h dot garvin at gmail dot com
  0 siblings, 0 replies; only message in thread
From: joseph dot h dot garvin at gmail dot com @ 2010-08-02 21:33 UTC (permalink / raw)
  To: gcc-bugs

It's fairly common in C and C++ libraries to have an enum with each element
representing an aspect of a request. In these situations it would be nice to be
able to deprecate specific enum members. For example the user wants to retrieve
a Foo from a server, and Foo's have 3 parts, they might make a request using an
API like this:

enum FooRequest {
    WANT_FIZZ = 1 << 0,
    WANT_BUZZ = 1 << 1,
    WANT_BEEZLE = 1 << 2
};

make_request(WANT_FIZZ | WANT_BUZZ, callback);

And perhaps WANT_BUZZ should be deprecated because now Foo's have some other,
better thing to request instead that should be transitioned to. It'd be nice to
write:

enum FooRequest {
    WANT_FIZZ = 1 << 0,
    WANT_BUZZ = 1 << 1 __attribute__((deprecated)),
    WANT_BEEZLE = 1 << 2,
    WANT_SUPERIOR_BUZZ = 1 << 3
};

So that at compile time users would be notified that WANT_BUZZ is no longer the
way to go.


-- 
           Summary: There should be a way to mark specific enum members as
                    deprecated
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joseph dot h dot garvin at gmail dot com


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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-02 21:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-02 21:33 [Bug c/45168] New: There should be a way to mark specific enum members as deprecated joseph dot h dot garvin at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).