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


Groups > comp.lang.c > #106235

Re: More problems with lcc-win

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c
Subject Re: More problems with lcc-win
Date 2017-03-16 09:57 +0100
Organization A noiseless patient Spider
Message-ID <oadjt4$hk7$1@dont-email.me> (permalink)
References (4 earlier) <oabom4$5ss$1@dont-email.me> <lny3w6h47p.fsf@kst-u.example.com> <oabt21$rkb$1@dont-email.me> <20170315184219.1e0c610d45be2e475412b258@gmail.com> <oac0ft$8e2$1@dont-email.me>

Show all headers | View raw


On 15/03/17 19:20, BartC wrote:
> On 15/03/2017 17:42, GOTHIER Nathan wrote:
>> On Wed, 15 Mar 2017 17:21:48 +0000
>> Richard Heathfield <rjh@cpax.org.uk> wrote:
>>
>>> Yes, but it's a problem that could easily have been avoided by making
>>> long 64 bits (or longer, if need be) and ignoring long long completely.
>>
>> Wrong since 32-bit long code would be invalid redefining long to be
>> 64-bit or
>> more. The committee guideline aims at no breaking existing code with
>> new rules.
> 
> Why? I thought C types weren't defined as exact widths. So long merely
> had to be at least as wide as int, and at least 32 bits.
> 
> Making long 64 bits oughtn't to have broken any properly written programs.

The trouble was the improperly written programs.

Since the days of 16-bit Windows, Windows programmers have been equating
"long" with "32-bit".  That remained the case with 32-bit Windows.  When
deciding about the 64-bit ABI, MS faced a dilemma.  The obvious choice
was to use the same ABI that everyone else used on x86-64, and the most
common choice for 64-bit ABIs in general, with 64-bit longs.  But that
would break code that assumed "long" is 32-bit.  On the third hand,
leaving "long" as 32-bit would break code that assumed "long" can hold a
pointer.  In the end, they decided that keeping long at 32-bit would
break less code.

Whether such improperly written code was from third-party applications,
or MS's own code for the Windows system or their applications, is
unknown AFAIK.

> 
> Now the common situation when 'int' is 32 bits, is that 'long long' is
> 64 bits; what's the point of 'long'?
> 

It is useful for portable code - not every system has 32-bit "int".  And
if you don't have C99, then you don't have "long long".

As 32-bit int gets more common, and C90 becomes less common, then "long"
is becoming less necessary.  If you are writing code for *nix and/or
Windows, and you are not limited to C90, then you are not going to need
"long" for anything except when dealing with third-party functions that
use it.

It is important to note that "long long", "long" and "int" are
considered separate types in C, even if they overlap in size.  Pointers
to these types are not compatible, and the compiler will assume they
don't alias.

For my own code, if I want specific sized types (and I usually do), I
stick to the types from <stdint.h>.  When I want 32 bits, I normally use
"int32_t" or "uint32_t" - not "long" or "int".

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


Thread

More problems with lcc-win mertesthomas@gmail.com - 2017-03-15 00:29 -0700
  Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 11:27 +0100
    Re: More problems with lcc-win scott@slp53.sl.home (Scott Lurndal) - 2017-03-15 13:18 +0000
      Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 15:22 +0100
        Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 08:26 -0700
    Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 08:25 -0700
      Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 16:46 +0100
        Re: More problems with lcc-win David Brown <david.brown@hesbynett.no> - 2017-03-15 17:07 +0100
          Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 09:52 -0700
            Re: More problems with lcc-win scott@slp53.sl.home (Scott Lurndal) - 2017-03-15 16:57 +0000
              Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 10:11 -0700
                Re: More problems with lcc-win scott@slp53.sl.home (Scott Lurndal) - 2017-03-15 18:17 +0000
            Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-15 17:21 +0000
              Re: More problems with lcc-win GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-03-15 18:42 +0100
                Re: More problems with lcc-win scott@slp53.sl.home (Scott Lurndal) - 2017-03-15 18:20 +0000
                Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-15 18:59 +0000
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-15 18:20 +0000
                Re: More problems with lcc-win GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-03-15 19:39 +0100
                Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 12:44 -0700
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-15 20:19 +0000
                Re: More problems with lcc-win David Brown <david.brown@hesbynett.no> - 2017-03-16 10:03 +0100
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-16 11:15 +0000
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-16 11:32 +0000
                Re: More problems with lcc-win David Brown <david.brown@hesbynett.no> - 2017-03-16 13:41 +0100
                Re: More problems with lcc-win GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-03-16 08:52 +0100
                Re: More problems with lcc-win David Brown <david.brown@hesbynett.no> - 2017-03-16 09:57 +0100
                Re: More problems with lcc-win antispam@math.uni.wroc.pl - 2017-03-16 13:53 +0000
                Re: More problems with lcc-win jm.bourguet@gmail.com - 2017-03-16 07:14 -0700
                Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-16 08:59 -0700
              Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 12:43 -0700
                Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-15 20:39 +0000
            Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 23:56 +0100
        Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-15 16:33 +0000
          Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 17:47 +0100
            Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 10:04 -0700
              Re: More problems with lcc-win jacob navia <jacob@jacob.remcomp.fr> - 2017-03-16 00:52 +0100
                Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 18:02 -0700
                Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 18:23 -0700
                Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-17 13:45 -0700
                Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-18 00:23 +0100
                Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-18 00:29 +0100
                Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-18 00:31 +0100
                Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-17 17:01 -0700
                Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-20 16:41 +0000
                Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-20 18:32 +0100
                Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-20 18:18 +0000
                Re: More problems with lcc-win bart4858@gmail.com - 2017-03-20 12:31 -0700
                Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-20 21:05 +0100
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-20 20:45 +0000
                Re: More problems with lcc-win Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-20 20:18 +0000
                Re: More problems with lcc-win David Brown <david.brown@hesbynett.no> - 2017-03-21 09:56 +0100
                Re: More problems with lcc-win Jorgen Grahn <grahn+nntp@snipabacken.se> - 2017-03-21 21:08 +0000
                Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-21 22:19 +0100
                Re: More problems with lcc-win Jorgen Grahn <grahn+nntp@snipabacken.se> - 2017-03-22 06:29 +0000
                Re: More problems with lcc-win supercat@casperkitty.com - 2017-03-21 16:12 -0700
                Re: More problems with lcc-win gordonb.s97bd@burditt.org (Gordon Burditt) - 2017-03-24 01:13 -0500
                Re: More problems with lcc-win supercat@casperkitty.com - 2017-03-24 08:16 -0700
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-26 03:18 -0700
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-26 12:35 +0100
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-29 05:17 -0700
                Re: More problems with lcc-win supercat@casperkitty.com - 2017-03-26 14:04 -0700
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-29 05:48 -0700
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-21 23:21 +0000
                Re: More problems with lcc-win Jorgen Grahn <grahn+nntp@snipabacken.se> - 2017-03-22 06:18 +0000
                Re: More problems with lcc-win gordonb.1neik@burditt.org (Gordon Burditt) - 2017-03-21 18:45 -0500
                Re: More problems with lcc-win jm.bourguet@gmail.com - 2017-03-22 01:02 -0700
                Re: More problems with lcc-win David Brown <david.brown@hesbynett.no> - 2017-03-22 10:35 +0100
                Re: More problems with lcc-win scott@slp53.sl.home (Scott Lurndal) - 2017-03-22 13:21 +0000
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-22 14:08 +0000
                Re: More problems with lcc-win scott@slp53.sl.home (Scott Lurndal) - 2017-03-22 15:37 +0000
                Re: More problems with lcc-win Gareth Owen <gwowen@gmail.com> - 2017-03-22 21:09 +0000
                Re: More problems with lcc-win scott@slp53.sl.home (Scott Lurndal) - 2017-03-21 13:09 +0000
                Re: More problems with lcc-win Jorgen Grahn <grahn+nntp@snipabacken.se> - 2017-03-21 21:15 +0000
                Re: More problems with lcc-win Ian Collins <ian-news@hotmail.com> - 2017-03-18 12:44 +1300
                Re: More problems with lcc-win jameskuyper@verizon.net - 2017-03-17 16:59 -0700
                Re: charsets Noob <root@127.0.0.1> - 2017-03-18 18:30 +0100
                Re: More problems with lcc-win David Brown <david.brown@hesbynett.no> - 2017-03-16 10:18 +0100
            Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-15 15:06 -0700
              Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-15 22:23 +0000
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-15 15:43 -0700
                Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 23:53 +0100
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-16 08:35 -0700
                Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-15 23:13 +0000
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-16 06:28 -0700
                Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-16 16:56 +0000
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-16 14:53 -0700
              Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 16:18 -0700
                Re: More problems with lcc-win scott@slp53.sl.home (Scott Lurndal) - 2017-03-16 18:03 +0000
                Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-16 19:29 +0100
                Re: More problems with lcc-win Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-16 21:38 +0000
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-17 08:58 -0700
                Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-17 09:45 -0700
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-17 10:33 -0700
                Re: More problems with lcc-win "James R. Kuyper" <jameskuyper@verizon.net> - 2017-03-17 14:20 -0400
                Re: More problems with lcc-win GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-03-17 20:18 +0100
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-18 00:44 -0700
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-18 13:31 +0000
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-18 15:54 -0700
                Re: More problems with lcc-win scott@slp53.sl.home (Scott Lurndal) - 2017-03-20 13:27 +0000
                Re: More problems with lcc-win GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-03-18 15:15 +0100
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-18 11:39 -0700
                Re: More problems with lcc-win GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-03-18 20:11 +0100
                Re: More problems with lcc-win BartC <bc@freeuk.com> - 2017-03-18 19:45 +0000
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-20 00:35 -0700
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-18 14:22 -0700
                Re: More problems with lcc-win GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-03-18 22:46 +0100
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-18 16:12 -0700
                Re: More problems with lcc-win supercat@casperkitty.com - 2017-03-18 18:01 -0700
                Re: More problems with lcc-win GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-03-19 03:21 +0100
                Re: More problems with lcc-win Ian Collins <ian-news@hotmail.com> - 2017-03-19 15:32 +1300
                Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-19 02:17 -0700
    Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-15 14:25 -0700
      Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 23:49 +0100
  Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 11:28 +0100
    Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-15 14:35 -0700
      Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 23:44 +0100
  Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 13:06 +0100
    Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-15 14:43 -0700
      Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 23:43 +0100
  Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 13:19 +0100
    Re: More problems with lcc-win mertesthomas@gmail.com - 2017-03-15 14:50 -0700
  Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 08:24 -0700
    Re: More problems with lcc-win jacobnavia <jacob@jacob.remcomp.fr> - 2017-03-15 16:47 +0100
      Re: More problems with lcc-win jameskuyper@verizon.net - 2017-03-15 09:04 -0700
      Re: More problems with lcc-win Keith Thompson <kst-u@mib.org> - 2017-03-15 09:15 -0700
        Re: More problems with lcc-win gazelle@shell.xmission.com (Kenny McCormack) - 2017-03-15 19:59 +0000
      Re: More problems with lcc-win Richard Heathfield <rjh@cpax.org.uk> - 2017-03-15 16:32 +0000

csiph-web