www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/05/15:18:37

Xref: news-dnh.mv.net comp.os.msdos.djgpp:782
Newsgroups: comp.os.msdos.djgpp
Path: news-dnh.mv.net!mv!news.sprintlink.net!howland.reston.ans.net!torn!watserv2.uwaterloo.ca!undergrad.math.uwaterloo.ca!not-for-mail
From: jojaste AT calum DOT csclub DOT uwaterloo DOT ca (James Ojaste)
Subject: Re: if problem
Lines: 43
Sender: news AT undergrad DOT math DOT uwaterloo DOT ca (news spool owner)
Nntp-Posting-Host: calum.csclub.uwaterloo.ca
Organization: University of Waterloo Computer Science Club
References: <DAyyCx DOT HxK AT jade DOT mv DOT net>
Date: Tue, 4 Jul 1995 14:21:25 GMT
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

In article <DAyyCx DOT HxK AT jade DOT mv DOT net>,
Mitran/Marcel/Mr  <nverever AT wendy DOT ee DOT mcgill DOT ca> wrote:
>Okay, I wrote a program which takes command line parameters. The program
>parses them in the following way:
>	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)*/
>				{...}
>However, if I remove the comment:
>/*The first parameter */, the -pb if doesn't work anymore.

Looks like you have unmatched comment delimiters.  For example:
/* This comment begin token is unmatched on this line
	code_that ("Won't run");	/* <- this is ignored, we're
					still in a comment */
	code_that ("Will run");		/* because the compiler sees
					the * / above... */

>	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

Oh yeah?  Try commenting out your entire program - your comments *will*
affect the compiler's output...  :-)

>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?

Your error, and no - unmatched parens, braces and comments are just
something that you have to be careful about - the compiler will complain
you about the parens and braces, but it has no idea what you meant
to comment out.

James

-- 
fn info guess {if {~ $guess 'James Ojaste'} {echo Right!} {~ $guess es-lover} {
echo Yup!} {~ $guess csclub.uwaterloo.ca} {echo Uh-huh!} {~ $guess INTX} {
echo Ding!} {echo Bzzzt!}}

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019