Re: [LONG] Strange occurences in Borland makefile

From: Henrik Stuart (hstuart@inoyfb.com)
Date: 06/02/02


Greetings,

On Monday, June 03, 2002 1:15:01 AM George Greer wrote:
> On Mon, 3 Jun 2002, Henrik Stuart wrote:

>>   Second, in several places in the code there will be warnings like:
>>   W8004  file.c  line:  'variable'  is assigned a value that is never
>>   used in function _function name_.

> Have a list of those?

act.wizard.c:1715: variable 'any' is...
boards.c:254: variable 'len' is...
castle.c:568: 'pupil2'
         781: 'ch_guard'
         848: 'gambler2'
magic.c:729: 'fmsg'
        729: 'msg'
        729: 'pfail'
        827: 'to_vict'
        826: 'spell'
olc.c:263: 'error'
      298: 'doremove'
spec_procs.c:126: 'len'
spells.c:288: 'len'

I think that was all.

>>   act.informative.c:
>>   ------------------
>>   205: condition always true:
>>     inspect  the  struct.. byte is a typedef for unsigned char. I.e.,

> It's only unsigned if your 'char' is unsigned.

Euh?  Considering, at least for Visual C++'s sake, that char is signed
per  default  I  don't see how that's connected. Now, byte is unsigned
per  default.  Perhaps  using  sbyte  would  prove more beneficial for
portability then. :o)

>>   1414: always false: if (len + nlen >= sizeof(buf) || nlen < 0)
>>     we  here  observe  that len and nlen are of type size_t that is a
>>     typedef  of... unsigned int. In other words the latter condition:
>>     nlen < 0 will always be false, given the nature of unsigned ints.

> Oops, 'nlen' was supposed to be 'int'.  That's what snprintf() returns.

Suppose that explains it. :o)

>>   db.c:
>>   -----
>>   654:  function specifies a return value but terminates with an exit
>>   statement.  the  function  still  requires  a  return  since  it's
>>   specified, hence W8070: "Function should return a value in function
>>   count_alias_records"

> Since the function never returns (on 'exit'), I don't see much point in
> wanting a return value.  The GNU C Library says:

> extern void exit (int __status) __THROW __attribute__ ((__noreturn__));

> where the '__noreturn__' avoids that.

There  are other ways than the GNU way. :o) Unfortunately I do not own
the  C  specification  so  I  can't  tell whether that is the way it's
supposed  to  be  done  (tm).  (Not  that gcc even warns about missing
returns unless you use -Wall).

--
Yours truly,
  Henrik Stuart (http://www.unprompted.com/hstuart/)

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT