Mail Archives: djgpp/1995/06/30/00:40:22
Okay, I wrote a program which takes command line parameters. The program
parses them in the following way:
...
if (*Param == '-') /*This part checks for a dash*/
{
Param++; /*Makes char *Param point to */
/*the next character in string */
switch (*Param){
... /*A few cases here, too long to mention */
case 'p':
Param++;
if (*Param == 'a') /*The first parameter(-pa)*/
{...}
if (*Param == 'b') /*The second parameter(-pb)*/
{...}
if (*Param == 'c') /*The third parameter(-pc) */
{...}
break;
}
}
Okay, now that is the basic structure of the parser. When I use
-pb or -pc, they execute their specific code, but -pa doesn't work because
it seems like the if is never tested. If I add the exact same code for the
-pa paramter after the test for the -pc parameter while keeping the original
if for the -pa, it works now. However, if I remove the comment:
/*The first parameter */, the -pb if doesn't work anymore.
I don't think it's normal that where I comment my code should
affect the compiler output. I guess it's true, well commented code
does lead to better programs! Seriously, is this a bug or a programming
error on my part? Am I the only one who has this problem?
Thanks in advance
Patrick Mitran
nverever AT ee DOT mcgill DOT ca
- Raw text -