Re: __FUNCTION__

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 08/25/97


______________________________ Reply Separator _________________________________

Figured out why I still get function names.  It seems that GCC can't test
for __FUNCTION__ with an #if as Daniel said.  However, it ignores any
attempt to #define it to anything else.  So any preprocessor that doesn't
have __FUNCTION__ will define it to __FILE__ and gcc will simply ignore the
redefinition.  Works for me.

PS - Angus, resend that message you mailed me about the buffer code and the
        NAK, I lost it.


     here:



     into the part of clear_buffer() function that check for over flows,
     you might want to add a call to strlen().  i.e.:

     sprintf(buf,"SYSERR: BUF: %s: Overflow in buffer from %s:%d Allocated
     size:%d, Present size:%d.",__FUNCTION__,clearme->who, clearme->line,
     clearme->size,strlen(clearme->data));
     log(buf);


     My main worry with this is wether or not it creates a core dump... I
     don't think it will as strlen just searched down the list for a '\0'
     (i hope)
     BTW: I love the magic number syntax... works much quicker then my idea
     of if(clearme->size<strlen(clearme->data)) crash;
     You might want to use a different magic number though, for example
     '0x06' which is ACK and only supposed to be used for networking....
     don't think it will appear in the middle of a string like '='(0x3D)
     will.
     --Angus


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST