Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c++ Subject: Re: two's complement idea Date: Thu, 28 Nov 2019 12:19:43 -0800 Organization: A noiseless patient Spider Lines: 40 Message-ID: <8636e7bvog.fsf@linuxsc.com> References: <86tv7dcfxr.fsf@linuxsc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="dce185ee50ea005ee4a34884a21fb89a"; logging-data="26629"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18RULleozsAzcXikZeD2B6CRG3OZ/PSRJw=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:wwU+x6pPHRPffr9y/+3iQc2+oqk= sha1:PHDZ/5wS7ggJivxhZUrodPSsZkc= Xref: csiph.com comp.lang.c++:70089 Öö Tiib writes: > On Saturday, 9 November 2019 15:55:38 UTC+2, Tim Rentsch wrote: > >> "Alf P. Steinbach" writes: >> >>> On 05.11.2019 03:55, Siri Cruise wrote: >>> >>>> In article , >>>> Bonita Montero wrote: >>>> >>>>> What would realls speak against that numieric_limits would include >>>>> a flag whether a type has a two's complement and maybe another flag that >>>>> says that a type has a two's complement wrap-around? >>>> >>>> #define ONESCOMPLEMENT (-1==~1) >>>> #define TWOSCOMPLEMENT (-1==~0) >>> >>> Nice idea. >>> >>> But please use `constexpr` or `const` declarations, not macros. >>> >>> Using macros conveys the idea that macros are a reasonable solution to >>> the problem of naming a compile time constant. >> >> Why do C++ fans hate the C preprocessor so much? > > It is not hate. We prefer to use macros when what these do can not > be done as simply by using inline functions, templates or constants. > > Reasons are that macros are names that ignore scope and work on > textual substitutions. Macros are harder to debug and cause > unanticipated effects and confusion in clumsy hands. However for > teams that manage to hire members with godly hands macros are > fine. :D This doesn't answer my question. I understand that macros have shortcomings in some applications. The question is why do C++ fans hate using macros even when, like here, the shortcomings don't apply?