public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Wodok <m.wodok@osb-ag.de>
To: gcc-help@gcc.gnu.org
Subject: Re: C++: No Warning for passing value > 255 as parameter to a function requiring "unsigned char"
Date: Tue, 26 Jul 2005 09:36:00 -0000	[thread overview]
Message-ID: <200507261115.45744.m.wodok@osb-ag.de> (raw)
In-Reply-To: <m3ll3yzynz.fsf@uniton.integrable-solutions.net>

Hi Gaby
hi Eljay,

thanks for your answer!

> Martin Wodok <m.wodok@osb-ag.de> writes:
> | Assigning 1000 is of course out of bounds for "unsigned char", thus the
>
> No, it is not.  Unsigned integer types are modulo types; it is no overflow.

Yes, they're modulo types, that's why this is NOT an error, but I still think 
that should be a WARNING. There're compilers like Tasking that throw a 
warning out on that one, so I'm really searching for a way to enable a 
warning for that one (maybe something like the warning -Wconversion), and not 
some extra code (Eljay, thanks anyway!!), because it should work on existing 
code and I don't want to get code-explosion (we're working embedded) just 
because some range-check that could be done by the compiler...

So it seems there's really no way for GCC to warn here?

Thanks again Gaby and Eljay,
/\/\artin

-- 
Dipl.-Inf. Martin Wodok
OSB AG Ingenieur- und IT-Dienstleistungen
Klenzestraße 38
80469 München
Telefon:  +49 (0)89/23 88 57-48
Telefax:  +49 (0)89/23 88 57-40

  reply	other threads:[~2005-07-26  9:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-22 13:51 Martin Wodok
2005-07-22 14:47 ` Gabriel Dos Reis
2005-07-26  9:36   ` Martin Wodok [this message]
2005-07-26 14:28     ` Eljay Love-Jensen
2005-07-26 21:54     ` Gabriel Dos Reis
2005-07-27  0:44       ` Sisyphus
2005-07-22 15:22 ` Eljay Love-Jensen
2005-07-22 15:24   ` Eljay Love-Jensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200507261115.45744.m.wodok@osb-ag.de \
    --to=m.wodok@osb-ag.de \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).