[comp.lang.c] typecasting constants

jharkins@sagpd1.UUCP (Jim Harkins) (12/20/89)

Our customer is trying to force a coding standard rule down our throats
that we don't like, but can't give an argument on why we hate it.  The
rule is "All constants will have their types explicitly specified."
This means we'll have

#define FRED ((long) 4)
#define WILMA  ((short) 9)

Outside of the fact that nobody else ever does this, and we've never had
a problem omitting the typecasts, whats a good argument against this?
Note we don't have a problem with things like '0x42L' when we know it
has to be a long.

jim
"Only dead fish go with the flow"

joshua@athertn.Atherton.COM (Flame Bait) (12/21/89)

In article <563@sagpd1.UUCP> jharkins@sagpd1.UUCP (Jim Harkins) writes:
>Our customer is trying to force a coding standard rule down our throats...
>This means we'll have
>
>#define FRED ((long) 4)
>#define WILMA  ((short) 9)
>
>whats a good argument against this?

If you have something like this:
#define NAME_SIZE (long)300
and then this code:
char name[NAME_SIZE] ;

Then some (all?) VMS C compilers will become very angry.  I do not think
they will compile the code, but I know they will complain.   

Why does your customer want you to do this?  

Joshua Levy                          joshua@atherton.com  home:(415)968-3718
                        {decwrl|sun|hpda}!athertn!joshua  work:(408)734-9822 

jharkins@sagpd1.uucp@canremote.uucp (jharkins@sagpd1.UUCP) (12/21/89)

From: jharkins@sagpd1.UUCP (Jim Harkins)
Orga: Scientific Atlanta-GPD, San Diego

Our customer is trying to force a coding standard rule down our
throats that we don't like, but can't give an argument on why we hate
it.  The rule is "All constants will have their types explicitly
specified." This means we'll have

#define FRED ((long) 4)
#define WILMA  ((short) 9)

Outside of the fact that nobody else ever does this, and we've never
had a problem omitting the typecasts, whats a good argument against
this? Note we don't have a problem with things like '0x42L' when we
know it has to be a long.

jim
"Only dead fish go with the flow"

---
 * Via MaSNet/HST96/HST144/V32 - UN C Language
 * Via Usenet Newsgroup comp.lang.c