www.digitalmars.com         C & C++   DMDScript  

c++.wxwindows - 2.4.1 vs 2.4.2 build differences - dmc_cond.txt

reply "Eliot" <eliot blennerhassett.gen.nz> writes:
I have been looking at the conditinal compilation related to compiler type,
and comparing the patch for 2.4.1, and the raw 2.4.2
I notice the patch often replaces #if defined(__SC__) with 
#if (defined (__SC__) && !defined(__DMCPP__))

This implies that DM has fewer limitations than the old Symantec C.
However, in 2.4.2 many of the same lines are still like the original 2.4.1
Can anyone explain why this is?

2.4.2 platform.h:

#if defined(_MSC_VER) && !defined(__MWERKS__)
#define __VISUALC__ _MSC_VER
#elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
#define __BORLANDC__
#elif defined(__WATCOMC__)
#elif defined(__SC__)
#define __SYMANTECC__
#endif  /* compiler */

#ifdef __SC__
#ifdef __DMC__
#define __DIGITALMARS__
#else
#define __SYMANTEC__
#endif
#endif

From here on I omit the double underscores from eg __DMC__
The end result of this is that if DM is used, 
SC,SYMANTECC,DMC,DIGITALMARS are defined
If Symantec C used
SC,SYMANTECC,SYMANTEC are defined

Scanning the source, I find that SYMANTECC is never used,
DMC,DIGITALMARS,SYMANTEC,SC are variously used.

IMHO it would reduce confusion considerable if
1) SYMANTECC eliminated, (not used) i.e. only have the second #ifdef __SC__
quoted above.

2) Throughout the source, occurrences of SC and DMC were replaced with 
DIGITALMARS,SYMANTEC or (DIGITALMARS || SYMANTEC) as appropriate.
I think there are about 20 occurrences.
Right now I think I dont know enough to say when SC means "Symantec or DM" and
where it means "only symantec"

Attached file shows search results from 2.4.2, and the 2.4.1 patch.

Enough raving for now. 
What are your opinions on this proposal?

regards

ELiot
Feb 17 2004
parent reply Arjan Knepper <arjan ask.me> writes:
Eliot wrote:

 I have been looking at the conditinal compilation related to compiler type,
 and comparing the patch for 2.4.1, and the raw 2.4.2
 I notice the patch often replaces #if defined(__SC__) with 
 #if (defined (__SC__) && !defined(__DMCPP__))
 
 This implies that DM has fewer limitations than the old Symantec C.
 However, in 2.4.2 many of the same lines are still like the original 2.4.1
 Can anyone explain why this is?

Because a lot of those #defines weren't in the cvs at the time the 2.4.2 release was cut.
 
 2.4.2 platform.h:
 
 #if defined(_MSC_VER) && !defined(__MWERKS__)
 #define __VISUALC__ _MSC_VER
 #elif defined(__BCPLUSPLUS__) && !defined(__BORLANDC__)
 #define __BORLANDC__
 #elif defined(__WATCOMC__)
 #elif defined(__SC__)
 #define __SYMANTECC__
 #endif  /* compiler */
 
 #ifdef __SC__
 #ifdef __DMC__
 #define __DIGITALMARS__
 #else
 #define __SYMANTEC__
 #endif
 #endif
 
 From here on I omit the double underscores from eg __DMC__
 The end result of this is that if DM is used, 
 SC,SYMANTECC,DMC,DIGITALMARS are defined
 If Symantec C used
 SC,SYMANTECC,SYMANTEC are defined
 
 Scanning the source, I find that SYMANTECC is never used,
 DMC,DIGITALMARS,SYMANTEC,SC are variously used.

This is because the graphics libs do not always use the wx setup.h file and thus don't have the defines from platform.h. Also symantec has had a version of the compiler for MAC and that one might be still in use.
 
 IMHO it would reduce confusion considerable if
 1) SYMANTECC eliminated, (not used) i.e. only have the second #ifdef __SC__
 quoted above.
 
 2) Throughout the source, occurrences of SC and DMC were replaced with 
 DIGITALMARS,SYMANTEC or (DIGITALMARS || SYMANTEC) as appropriate.
 I think there are about 20 occurrences.
 Right now I think I dont know enough to say when SC means "Symantec or DM" and
 where it means "only symantec"

Rememeber this: Symantec always defines __SC__ DigitalMars always defines __SC__ and __DMC__ So to differentiate between Symantec and Digitalmars you have to check both. Now _READ_ the code and you will. If I'm correct a lot if not all of the old SYMANTEC defines will disappear in the 2.5 versions. Arjan
Feb 18 2004
parent reply Eliot <eblennerhassett audioscience.com> writes:
Thanks for your reply

Arjan Knepper wrote:

 Eliot wrote:
 
 This implies that DM has fewer limitations than the old Symantec C.
 However, in 2.4.2 many of the same lines are still like the original 
 2.4.1
 Can anyone explain why this is?

Because a lot of those #defines weren't in the cvs at the time the 2.4.2 release was cut.

These ones are left, detecting MACOS? CVS 2.4.2
 src\png\pngconf.h(230): defined(THINK_C) || defined(__SC__) ||
defined(TARGET_OS_MAC)
 src\zlib\zconf.h(90): #if defined(__MWERKS__) || defined(applec)
||defined(THINK_C) ||defined(__SC__)
 src\zlib\zutil.h(164): #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) &&
!defined(__SC__)

Your patch
 wxWindows-2.4.1\src\png\pngconf.h(230): defined(THINK_C) || (defined(__SC__)
&& !defined(__DMCPP__))|| defined(TARGET_OS_MAC)
 wxWindows-2.4.1\src\zlib\zconf.h(90): #if defined(__MWERKS__) ||
defined(applec) ||defined(THINK_C) || (defined(__SC__) && !defined(__DMCPP__))
 wxWindows-2.4.1\src\zlib\zutil.h(164): #if defined(SMALL_MEDIUM) &&
!defined(_MSC_VER) && (!defined(__SC__) || defined(__DMCPP__))

 2.4.2 platform.h:


 From here on I omit the double underscores from eg __DMC__
 The end result of this is that if DM is used, 
 SC,SYMANTECC,DMC,DIGITALMARS are defined
 If Symantec C used
 SC,SYMANTECC,SYMANTEC are defined

 Scanning the source, I find that SYMANTECC is never used,
 DMC,DIGITALMARS,SYMANTEC,SC are variously used.

This is because the graphics libs do not always use the wx setup.h file and thus don't have the defines from platform.h.

Yes, I see that.
 Also symantec has had a version of the compiler for MAC and that one 
 might be still in use.
 
 IMHO it would reduce confusion considerable if
 1) SYMANTECC eliminated, (not used) i.e. only have the second #ifdef 
 __SC__
 quoted above.

 2) Throughout the source, occurrences of SC and DMC were replaced with 
 DIGITALMARS,SYMANTEC or (DIGITALMARS || SYMANTEC) as appropriate.
 I think there are about 20 occurrences.
 Right now I think I dont know enough to say when SC means "Symantec or 
 DM" and
 where it means "only symantec"

Rememeber this: Symantec always defines __SC__ DigitalMars always defines __SC__ and __DMC__ So to differentiate between Symantec and Digitalmars you have to check both.

To take a concrete example of what I suggest src\msw\gdiimage.cpp(537): #if defined(__WIN32__) && (!defined(__SC__) || defined (__DIGITALMARS__) ) is equivalent to the more readable #if defined(__WIN32__) && !defined(__SYMANTEC__ )) In fact tiffcomp.h does this kind of thing, but it hasn't extended back to the main code.
 Now _READ_ the code and you will.

...?
 
 If I'm correct a lot if not all of the old SYMANTEC defines will 
 disappear in the 2.5 versions.
 
 Arjan

Feb 18 2004
parent Arjan Knepper <arjan ask.me> writes:
Eliot wrote:
 Rememeber this:
 Symantec always defines __SC__
 DigitalMars always defines __SC__ and __DMC__

 So to differentiate between Symantec and Digitalmars you have to check 
 both.

Exactly my point - deal with this in platform.h (+ graphicformatxyz.h if needed) To take a concrete example of what I suggest src\msw\gdiimage.cpp(537): #if defined(__WIN32__) && (!defined(__SC__) || defined (__DIGITALMARS__) ) is equivalent to the more readable #if defined(__WIN32__) && !defined(__SYMANTEC__ ))

Yes it is although I would make __SYMANTEC__ be more expresive about the fact we're talking realy ONLY old symantec here. If i'm correct this is the way thing are handled in the 2.5 branch.
 
 In fact tiffcomp.h does this kind of thing, but it hasn't extended back 
 to the main code.
 
 Now _READ_ the code and you will.

...?

I had the impression you did not expect __SC__ to be defined as well as __DMC__ with DigitalMars. Some people made already mistakes with this. Arjan
Feb 18 2004