From: Bo Persson on 1 Feb 2010 11:49 Vladimir Grigoriev wrote: > Duane, I am not arguing that macros are dangerous. I say that the C > standard did not offer an alternative for the macros max/min. And > when somebody asks what to do the same people advise him to write > these macros yourself and use them! At least as far as I know most > projects on C includes these macros in their code. Moreover the > Microsoft itself includes these macros! But they are not part of the compiler or standard library, they are part of the Windows headers (an application). Bo Persson
From: Vladimir Grigoriev on 1 Feb 2010 12:12 Yes! And this demonstrates one more what I said already that C-programmers have to include these macros in their C projects. So it would be interesting to read C standard Committee rationale relative to these macros. I can not find it. Vladimir Grigoriev "Bo Persson" <bop(a)gmb.dk> wrote in message news:7soevuFd87U1(a)mid.individual.net... > Vladimir Grigoriev wrote: >> Duane, I am not arguing that macros are dangerous. I say that the C >> standard did not offer an alternative for the macros max/min. And >> when somebody asks what to do the same people advise him to write >> these macros yourself and use them! At least as far as I know most >> projects on C includes these macros in their code. Moreover the >> Microsoft itself includes these macros! > > But they are not part of the compiler or standard library, they are part > of the Windows headers (an application). > > > Bo Persson > >
From: Ulrich Eckhardt on 1 Feb 2010 13:08 Vladimir Grigoriev wrote: > Ulrich, your position has no any reasonable base. In fact it looks the > following way. You say that macros (as it follows including min/max > macros) are evils. Right. There are various reasons macros are evil, see e.g. the C++ FAQ at parashift's. > O.k., and what to do to find minimal/maximum values? You answer: "To > write these macros yourself!" Is not it very strange, is it? Yes, it is strange that I get misquoted. The real quote of what I said is: "[...]it isn't hard to write similar code using the ternary operator." That doesn't mean that you should put that code into a macro. Putting it into a function is one alternative, though lack of overloading makes it cumbersome in C. The other alternative is obviously to use the ternary operator directly. Uli -- C++ FAQ: http://parashift.com/c++-faq-lite Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
From: Vladimir Grigoriev on 1 Feb 2010 14:22 If you will start to use the conditional operator directly you will finish with witting the macros!:) You have forgotten that programmers passed this way already. Otherwise why appeared the macros in C and why producers of compilers include them till now? Vladimir Grigoriev "Ulrich Eckhardt" <eckhardt(a)satorlaser.com> wrote in message news:9uhj37-6i9.ln1(a)satorlaser.homedns.org... > Vladimir Grigoriev wrote: >> Ulrich, your position has no any reasonable base. In fact it looks the >> following way. You say that macros (as it follows including min/max >> macros) are evils. > > Right. There are various reasons macros are evil, see e.g. the C++ FAQ at > parashift's. > >> O.k., and what to do to find minimal/maximum values? You answer: "To >> write these macros yourself!" Is not it very strange, is it? > > Yes, it is strange that I get misquoted. The real quote of what I said > is: "[...]it isn't hard to write similar code using the ternary operator." > That doesn't mean that you should put that code into a macro. Putting it > into a function is one alternative, though lack of overloading makes it > cumbersome in C. The other alternative is obviously to use the ternary > operator directly. > > Uli > > -- > C++ FAQ: http://parashift.com/c++-faq-lite > > Sator Laser GmbH > Geschaftsfuhrer: Thorsten Focking, Amtsgericht Hamburg HR B62 932
From: Ulrich Eckhardt on 2 Feb 2010 03:00 Vladimir Grigoriev wrote: > If you will start to use the conditional operator directly you will finish > with witting the macros!:) No I wont, because I understand the dangers of macros. > You have forgotten that programmers passed this way already. > Otherwise why appeared the macros in C and why producers of > compilers include them till now? Can you tell me where to find it in the latest GCC release? [Snipped TOFU] Uli -- C++ FAQ: http://parashift.com/c++-faq-lite Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: problem with scope and functions Next: package installation for explorer bar vc++ |