[vorbis-dev] ogg123 remote interface

Paul Martin pm at nowster.zetnet.co.uk
Sun Oct 6 04:26:27 PDT 2002



On Sun, Oct 06, 2002 at 11:48:27AM +0200, Joost Remijn wrote:

> > >   char * initialized to 0 instead of "".
> >
> > that means something different -- i hope you checked it doesn't
> > actually matter
> 
> yep i checked. Does it ever make sense to assign "" to a pointer?

"" is a pointer to a char '\0'. Yes, it does make sense as an
initializer sometimes. Convoluted example:

void example(const char *a, int i) {
 char *b = "";

 if (i == 99) {
  b = ", with 99";
 }

 printf("%s%s\n",a,b);
}

If you initialised b to 0 (NULL), printf may print out "(null)" (or
segfault, depending on your C library) instead of the empty string.


-- 
Paul Martin <pm at zetnet.net>
--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis-dev mailing list