www.digitalmars.com         C & C++   DMDScript  

D - version ID enumeration

reply "Robert" <no spam.ne.jp> writes:
How about the following?

version(A, B, C) {  // <- Here!
    version = D;
}

instead of

version(A) {
    version = D;
}
version(B) {
    version = D;
}
version(C) {
    version = D;
}

Ditto debug.
Jan 22 2004
next sibling parent Brad Anderson <brad sankaty.dot.com> writes:
and this:

version(A, B, C) {
    version = D;
} else {
    version = E;
}

Ditto debug.

BA

Robert wrote:

 How about the following?
 
 version(A, B, C) {  // <- Here!
     version = D;
 }
 
 instead of
 
 version(A) {
     version = D;
 }
 version(B) {
     version = D;
 }
 version(C) {
     version = D;
 }
 
 Ditto debug.
 
Jan 22 2004
prev sibling parent reply "Y.Tomino" <demoonlit inter7.jp> writes:
If you request the power like #if of C, I think we need version ID
"expression".

For example, "windows.h" has this line:

#if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) &&
!defined(_IA64_) && !defined(_AMD64_) && defined(_M_IX86)

version(!_68K_ && !_MPPC_ && !_X86_ && !_IA64_ && !_AMD64_ && _M_IX86) {

"&&" "||" "!", and, version numbers are necessary every ID.

#if defined(_WIN32_WINNT) && (WINVER < 0x0400) && (_WIN32_WINNT > 0x0400)

version WINVER = 0x0501;
version _WIN32_WINNT = 0x501;
version(_WIN32_WINNT && WINVER < 0x0400 && _WIN32_WINNT > 0x0400) {

But I feel it doesn't look good in complex pre-processor to D...

YT

"Robert" <no spam.ne.jp> wrote in message
news:buqh4s$20a8$1 digitaldaemon.com...
 How about the following?

 version(A, B, C) {  // <- Here!
     version = D;
 }

 instead of

 version(A) {
     version = D;
 }
 version(B) {
     version = D;
 }
 version(C) {
     version = D;
 }

 Ditto debug.
Jan 23 2004
parent reply "Walter" <newshound digitalmars.com> writes:
"Y.Tomino" <demoonlit inter7.jp> wrote in message
news:buqq68$2g1i$1 digitaldaemon.com...
 If you request the power like #if of C, I think we need version ID
 "expression".

 For example, "windows.h" has this line:

 #if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) &&
 !defined(_IA64_) && !defined(_AMD64_) && defined(_M_IX86)

 version(!_68K_ && !_MPPC_ && !_X86_ && !_IA64_ && !_AMD64_ && _M_IX86) {

 "&&" "||" "!", and, version numbers are necessary every ID.

 #if defined(_WIN32_WINNT) && (WINVER < 0x0400) && (_WIN32_WINNT > 0x0400)

 version WINVER = 0x0501;
 version _WIN32_WINNT = 0x501;
 version(_WIN32_WINNT && WINVER < 0x0400 && _WIN32_WINNT > 0x0400) {

 But I feel it doesn't look good in complex pre-processor to D...
I've seen many constructs like the above, and they scream "rewrite the code" to me.
May 02 2004
parent "Y.Tomino" <demoonlit inter7.jp> writes:
I suppose so.
But there are codes in "windows.h".
I've wanted to convert mechanically.

Thank you.
YT

"Walter" <newshound digitalmars.com> wrote in message
news:c74nba$s6b$1 digitaldaemon.com...
 "Y.Tomino" <demoonlit inter7.jp> wrote in message
 news:buqq68$2g1i$1 digitaldaemon.com...
 If you request the power like #if of C, I think we need version ID
 "expression".

 For example, "windows.h" has this line:

 #if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) &&
 !defined(_IA64_) && !defined(_AMD64_) && defined(_M_IX86)

 version(!_68K_ && !_MPPC_ && !_X86_ && !_IA64_ && !_AMD64_ && _M_IX86) {

 "&&" "||" "!", and, version numbers are necessary every ID.

 #if defined(_WIN32_WINNT) && (WINVER < 0x0400) && (_WIN32_WINNT >
0x0400)
 version WINVER = 0x0501;
 version _WIN32_WINNT = 0x501;
 version(_WIN32_WINNT && WINVER < 0x0400 && _WIN32_WINNT > 0x0400) {

 But I feel it doesn't look good in complex pre-processor to D...
I've seen many constructs like the above, and they scream "rewrite the
code"
 to me.
May 03 2004