Permitted locations of a version condition

Phil Deets pjdeets2 at gmail.com
Thu Oct 29 17:32:56 PDT 2009


Hello, I looked over the language specification, and I could not find any  
statement which says where version conditions are permitted. I assumed  
that they would be permitted most places that #if would be reasonable in  
C, but evidently that is not true as they do not work within enumerations.  
I would definitely like the following code to work.

enum Tag
{
    A, B, C,
    version (5) {
       D, E,
    }
    version (7) {
       F, G,
    }
    // ...
}

Added enumerated values based on versions seems like something that would  
be desirable. I ran into this need when converting a header file to D.

Does anyone know where version conditions are and are not allowed  
currently?
Would version conditions within enumerations be a good feature to add to  
D2?

If people like the idea, but the implementation is prevented due to  
manpower issues, I can possibly try to implement it if you give me a  
pointer on potential issues and where to look within the source code.



More information about the Digitalmars-d mailing list