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 32,764 of 33,346   
   Seungbeom Kim to All   
   Re: Wouldn't it be good to refactor __LI   
   27 Dec 12 02:36:45   
   
   From: musiphil@bawi.org   
      
   On 2012-12-22 23:50, fmatthew5876 wrote:   
   >> link to a 23-page document? More specifically, how would replacing   
   >> __LINE__, etc.  with a non-macro solution result in a better   
   >> program?   
   >   
   > I gave an example of this above with logging frameworks. Right now   
   > your log functions must either be macros or take macro arguments to   
   > automatically add file, line, and/or function information.   
   >   
   > This leads to naming problems as macros cannot be put into   
   > namespaces.   
      
   You wanted to avoid something like this:   
      
        myLineInfoPrinter(__FILE__, __LINE__, __func__);   
      
   and though you admitted that this worked perfectly:   
      
        struct LineInfo { ... };   
        #define LINE_INFO (LineInfo( __FILE__, __func__, __LINE__ ))   
      
        myLineInfoPrinter(LINE_INFO);   
      
   you wanted to use something like this eventually:   
      
        namespace std { struct line_info { ... }; }   
        myLineInfoPrinter(std::linfo);   
      
   I don't understand why the first two solutions are not sufficient and   
   what problems they have that the third one solves, besides the only   
   fact that they don't involve macros.   
      
   --   
   Seungbeom Kim   
      
      
         [ 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