Re: c question



On Fri, 1 Oct 1999, Tom Gilbert wrote:

> This is the right solution though :)
> 
> I like:
> 

OK, my ideas on this (they boil down to: "Who needs to strdup() it
anyway"):

void function (const char *in_string)
               ^^^^^
>  {

>  	if( string == NULL ) {
>  		string = "default";

>  	}
>  
>  	/* ... */
>  


>  }
> 
> int main()
>  {
>        function( "moo" );
>        function( NULL );
>  }
> 

Nils
-- 
Nils Philippsen / Vogelsangstrasse 115 / D-70197 Stuttgart / +49.711.6599405
nils@wombat.dialup.fht-esslingen.de / nils@fht-esslingen.de / nils@redhat.de
   The use of COBOL cripples the mind; its teaching should, therefore, be
   regarded as a criminal offence.                  -- Edsger W. Dijkstra



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]