Because the "for" statement parameters initialize "c" to 1, there is actually 
no way for "c" to ever be 0 at that point.  "c" is not an argument to the 
program, it is just a local variable.

Of course, a good optimizer will eliminate the superfluous test as "always 
true" and generate no code for it.

If someone invokes the program (from wherever) with no arguments, "argc" will 
be zero and the for loop will not execute at all, so the "if" statement will 
never be executed in that case.

HTH

Peter

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of John McKown
Sent: Monday, July 29, 2013 6:28 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Establishing and using Unix file system and USS under z/OS

I don't think that it can if the code is invoked from the shell itself. But
it could be if someone did an exec() passing in a 0. Why would they do
that? I don't know of any reason.

On Mon, Jul 29, 2013 at 5:01 PM, retired mainframer <
retired-mainfra...@q.com> wrote:

> :>: -----Original Message-----
> :>: From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU]
> On
> :>: Behalf Of Ze'ev Atlas
> :>: Sent: Monday, July 29, 2013 6:55 AM
> :>: To: IBM-MAIN@LISTSERV.UA.EDU
> :>: Subject: Re: Establishing and using Unix file system and USS under z/OS
>
> <snip>
>
> :>:  main(int argc, char *argv[])
> :>:  {
> :>:     int c;
> :>:     int d;
> :>:     int i;
> :>:     FILE * mypds;
> :>:
> :>:     for ( c = 1 ; c < argc ; c++)
> :>:     {
> :>:        if (c > 0)
>
> Can this ever be false?
--

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to