t-delegated.example.com> 31ce477a   
   From: barmar@alum.mit.edu   
      
   In article ,   
    Rick Jones wrote:   
      
   > Jorgen Grahn wrote:   
   > > A brief question: are htonl(), ntohl() and friends allowed to   
   > > evaluate their argument more than once (i.e. if they're implemented   
   > > naively as macros?)   
   >   
   > > The man pages I've seen are silent on the subject so one would   
   > > assume they behave like normal functions -- but I've wasted a day   
   > > debugging a problem caused by my (in-house) implementation   
   > > evaluating the argument four times.   
   >   
   > Not that I've ever seen any real chapter and verse on htonl/ntohl, my   
   > gut is telling me I bet that sort of issue was never really   
   > considered and so would be undefined.   
   >   
   > rick jones   
      
   I think the general expectation is that if something is described as a   
   function in some specification, it should behave like a function. If   
   you decide to implement it using a macro, you have to maintain the   
   functional semantics.   
      
   But why would you implement this as a macro? Standard C has had inline   
   functions for more than a decade.   
      
   --   
   Barry Margolin, barmar@alum.mit.edu   
   Arlington, MA   
   *** PLEASE don't copy me on replies, I'll read them in the group ***   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|