Re: C run-time library
From: Doug Harrison [MVP] (dsh_at_mvps.org)
Date: 06/01/04
- Next message: Doug Harrison [MVP]: "Re: delete"
- Previous message: Peri: "Re: How to read binary data from a multicast port ?"
- In reply to: Jerry Coffin: "Re: C run-time library"
- Next in thread: Jerry Coffin: "Re: C run-time library"
- Reply: Jerry Coffin: "Re: C run-time library"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 01 Jun 2004 11:25:40 -0500
Jerry Coffin wrote:
>In article <rfkmb056i2m2c28aoh31gfsmjcruimerc2@4ax.com>, dsh@mvps.org
>says...
>
>[ ... ]
>
>> In a word, NO, NO, NO. OK, so that was three words. :) It's hard to imagine
>> a significant body of code that could be compiled in a CRT-neutral way.
>
>I find it sufficiently easy to imagine that I do it on a regular
>basis.
>
>> The only reason I can see to use /Zl is to save space in libraries,
>
>If that's all you can see, you should learn to look more carefully.
>
>> which these
>> days would appear to amount to an insignificant amount of space.
>
>If space saving was the primary concern, they might as well remove
>the switch entirely. It's not.
Programs and the static libraries they use should be compiled using the same
CRT option and linked to the indicated CRT. The code that is generated
differs for the compiler switches which specify the CRT, namely /ML, /MT,
and /MD and their debug variants. You might want to grep the VC headers
separately for _DLL and _MT to convince yourself of this; it should at least
give you an idea where the static libraries you write "on a regular basis"
may fall apart when used in ways you haven't considered.
If you can avoid using those parts of the CRT that vary with the _DLL and
_MT macros and thus achieve your "CRT-neutral static library", by all means,
knock yourself out. Just be certain to vet everything with a high powered
microscope with each compiler version and CRT flavor you use, because as a
-Zl fan, you're sacrificing a useful link-time antibugging feature, while
making promises that can be broken for you at any time. I could see using
-Zl if you're not using the CRT at all, but if that's the case, why are we
having this discussion?
>> See my answer and Carl's follow-up example for the correct approach.
>
>I already saw them. IMO, far from being "the correct approach" they
>presented what is, at best, a mediocre fall-back for dealing with
>code that's usually poorly designed.
Then by that "reasoning", I guess MS is clueless with respect to lines
49-108 of afx.h. I guess MS and Dinkumware are out there in la la land with
yvals.h/use_ansi.h. And what about those "mediocre" Boost developers and
their auto_link.hpp. Are they all just a bunch of knuckleheads? Or is it
possible they understand the issues in greater depth than you and act
accordingly?
-- Doug Harrison Microsoft MVP - Visual C++
- Next message: Doug Harrison [MVP]: "Re: delete"
- Previous message: Peri: "Re: How to read binary data from a multicast port ?"
- In reply to: Jerry Coffin: "Re: C run-time library"
- Next in thread: Jerry Coffin: "Re: C run-time library"
- Reply: Jerry Coffin: "Re: C run-time library"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|