Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #91530

Re: unsigned int

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: unsigned int
Date 2016-08-01 23:01 +0200
Organization A noiseless patient Spider
Message-ID <nnodbf$kmv$1@dont-email.me> (permalink)
References (2 earlier) <nnn35u$2dd$1@dont-email.me> <nnnnqr$589$1@dont-email.me> <nnnpdf$b3s$1@dont-email.me> <nno33q$fto$1@dont-email.me> <lnpops48jt.fsf@kst-u.example.com>

Show all headers | View raw


On 01/08/16 21:02, Keith Thompson wrote:
> Les Cargill <lcargill99@comcast.com> writes:
>> David Brown wrote:
<snip>
>
>> Because warnings. With the right compiler options, C++ expects a char *
>> to be a char *, not some typedef equivalent to a char *.
>>
>> This happens with Mingw 3.4.5 with g++ -I . -Wall -c
>
> Hmm?  In both C and C++, "typedef" creates a new name for an existing
> type.  Do you have an example where g++ complains about mixing char*
> with a type name that's a typedef for char*?

That was my thought too.  But perhaps Les has an example to show us.

>
> [...]
>
>> #assert(CHAR_BIT==8) is easy enough.
>
> But non-standard; there is no #assert directive (unless it's an
> extension).
>

<https://gcc.gnu.org/onlinedocs/cpp/Obsolete-Features.html>

#if (CHAR_BIT != 8)
#error This code needs 8-bit chars!
#endif

or (using the best new feature of C11, IMHO) :

_Static_assert(CHAR_BIT == 8, "This code needs 8-bit chars!");

Neither of these are difficult.  But nor is simply using uint8_t or 
int8_t where those make the most sense in the code.

Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: unsigned int "Osmium" <r124c4u102@comcast.net> - 2016-07-31 12:40 -0500
  Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-01 11:01 +0200
    Re: unsigned int James Kuyper <jameskuyper@verizon.net> - 2016-08-01 10:15 -0400
    Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-01 09:59 -0500
      Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-01 17:21 +0200
        Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-01 09:55 -0700
          Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-01 22:42 +0200
            Re: unsigned int supercat@casperkitty.com - 2016-08-01 14:18 -0700
        Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-01 13:11 -0500
          Re: unsigned int Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-01 19:46 +0100
            Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-01 18:20 -0500
              Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-02 10:18 +0200
                Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-02 09:35 -0500
                Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-02 08:00 -0700
                Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-02 11:12 -0500
                Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-02 17:11 +0200
                Re: unsigned int Les Cargill <lcargill99@comcast.com> - 2016-08-02 11:55 -0500
                Re: unsigned int supercat@casperkitty.com - 2016-08-02 10:16 -0700
                Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-03 14:02 +0200
                Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-03 08:58 -0700
                Re: unsigned int James Kuyper <jameskuyper@verizon.net> - 2016-08-02 13:57 -0400
                Re: unsigned int Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-08-02 19:30 +0100
                Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-02 11:38 -0700
                Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-03 14:12 +0200
                Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-03 13:45 +0200
          Re: unsigned int Keith Thompson <kst-u@mib.org> - 2016-08-01 12:02 -0700
            Re: unsigned int David Brown <david.brown@hesbynett.no> - 2016-08-01 23:01 +0200

csiph-web