Bug 000337

When Created: 05/22/2001 16:20:01
Against DJGPP version: 2.03
By whom:
Abstract: unterminated character constant
using an apostrophe in comments will generate the error "unterminated string constant". discovered this while compiling the following source using "gcc myecho.c -o myecho.exe"

error is on line 15:

 *  and thus be unaware of any whitespace. each approach has it's       *

yes... i know that it should be "its" and not "it's" ;-)

 *                                                                      *
 *  myecho.c (dos version)                                              *
 *                                                                      *
 *  homemade implementation of the echo command, common to unix & dos,  *
 *  myecho is one half of an experiment that attempts to discern the    *
 *  only apparently visible difference in behavior between the unix     *
 *  dos versions of echo, that being the parsing of whitespace given    *
 *  as input. the included version of echo in unix will strip out all   *
 *  extraneous whitespace and then feed back arguments with one space   *
 *  between each character string. the included version of echo in dos  *
 *  will feed back arguments along with any extra whitespace. my theory *
 *  is that the dos echo is receiving a single string as an argument,   *
 *  where the unix echo will receive an array of strings as arguments   *
 *  and thus be unaware of any whitespace. each approach has it's       *
 *  advantages and disadvantages, but that is not the concern of this   *
 *  experiment. if myecho will not return whitespace, then we can       *
 *  assume with a reaonable certainty that the dos shell is passing     *
 *  commmand line arguments in a structure similar to that of unix. if  *
 *  the dos shell is instead passing a single string or possibly an     *
 *  array with only two strings, the command and then argument string.  *
 *  we shall see...                                                     *
 *                                                                      *

#include <stdio.h>                      /* standard input/output library */

  int argc;                             /* argument count */
  char *argv[];                         /* array of pointers to strings */

int main(argc, argv)                    /* unix-style parameters */
  int i;                                /* index counter for printf loop */

  for(i=1;i<argc;i++)                   /* loop runs through string array */
    printf("%s ",argv[i]);              /* print each string and a space */
  printf("\n");                         /* print newline */
  return(0);                            /* return no error */

Note added: 05/22/2001 17:05:10
By whom:
Well if you didn't terminate the first line with "*/" it would probably go better.



Note added: 05/23/2001 08:48:03
By whom:
oh god. i've been smoking way too much crack. thanks!

Closed on 05/23/2001 08:52:11: i've been smoking crack
By whom:

  webmaster     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010