Re: [LONG] Strange occurencies in Borland makefile

From: George Greer (greerga@circlemud.org)
Date: 06/02/02


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

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

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

--
George Greer
greerga@circlemud.org

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