home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,930 of 33,346   
   Martin B. to Miles Bader   
   Re: Are MACROS good and can the compiler   
   14 Feb 12 17:17:55   
   
   From: 0xCDCDCDCD@gmx.at   
      
   On 13.02.2012 18:51, Miles Bader wrote:   
   > "Martin B."<0xCDCDCDCD@gmx.at>  writes:   
   >> IMHO, the namespace problem with macros is *far* too much exaggerated.   
   >> Sure, MS/Windows defining macros named `min()` and `max()` was (is) dead   
   >> stupid, but `BOOST_FOREACH()` or `MY_THROW_CONTEXT_AWARE_EXCEPTION()` is   
   >> hardly going to collide with anything.   
   >   
   > Er, no doubt, but it results in macros having stupidly long and   
   > annoying names.   
   >   
   > Namespaces are _vastly_ better in that regard (even if one avoids   
   > "using namespace", references from within a namespace automatically   
   > use it, and that alone hugely cuts down the number of annoying   
   > prefixes).  Result: more readable code.   
   >   
      
   I completely agree. That's why you only use macros when you have to. But in   
   those cases where you have to (in C++) I have not found one case where the   
   stupidly long names where such a big deal, because it was either used very   
   locally or the non-macro    
   alternative would have been *even worse*.   
      
   Granted, `BOOST_FOREACH` is an example where a simpler, lowercaser name would   
   be much better. But I'd rather write BOOST_FOREACH than spell out the iterator   
   based for loop explicitly, because that's even *less* readable.   
      
   cheers,   
   Martin   
   --   
   Good C++ code is better than good C code, but   
   bad C++ can be much, much worse than bad C code.   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca