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


Groups > comp.lang.c > #71833

Re: Making sense of warning about "initialization makes pointer from integer without a cast"

From Richard Heathfield <rjh@cpax.org.uk>
Newsgroups comp.lang.c
Subject Re: Making sense of warning about "initialization makes pointer from integer without a cast"
Date 2015-10-04 19:11 +0100
Organization A noiseless patient Spider
Message-ID <murq0j$4oa$1@dont-email.me> (permalink)
References (1 earlier) <muq5i6$env$1@dont-email.me> <muq62o$9up$1@speranza.aioe.org> <muq6k3$i2m$1@dont-email.me> <muq7m9$c80$1@speranza.aioe.org> <561166A5.5070806@verizon.net>

Show all headers | View raw


On 04/10/15 18:49, James Kuyper wrote:

<snip>

> In that sub-thread, Richard Heathfield correctly identified the common
> sub-set of C90, C99, and C2011 as the maximally portable version of C to
> use. However, if you're going to use that sub-set, I'd recommend
> compiling it with C2011, and only compiling it with C90 to confirm that
> the code is indeed within that common subset.

I'd agree with that, actually. Well, the order doesn't matter very much 
to me, but I'd certainly agree that it should be compiled under the 
rules of each standard, and regression tests conducted for each 
executable program thus produced.

> However, a key issue is - do you really need your code to be "maximally
> portable"? It's sort-of like shopping for computers - do you really need
> the most powerful available desktop computer? It's easy to say, but when
> you actually have to pay for it, it may make more sense to choose a less
> powerful system that is still powerful enough for your needs, but costs
> a whole lot less money.

Right. Portability comes at a cost. (Non-portability comes at a 
different cost.)

If I don't need portable, I generally use <cough> C++.

<snip>

> Richard Heathfield has never seen any new feature that he considered
> sufficiently worthwhile to justify accepting the reduction in
> portability - the "never" in that statement make me suspect, that he's
> letting a powerful preference for maximal portability cloud his judgment
> of the value of those features.

Much as I love C, if portability is not an issue then I will tend to 
gravitate to the toy-box, and the biggest, brightest toy-box in the room 
is C++.

> Richard says that his clients require him to produce code that must be
> portable even to machines for which there's no C99 implementation
> available. Ordinarily, I'd be skeptical of such a claim, mainly because
> there's relatively few such systems. However, I don't actually know who
> his clients are, or what they've asked him to do, so he might be right -
> but he himself has admitted that he's prone to exaggeration,

No, I haven't! (Well, all right, maybe I have admitted that, a little 
bit. But hardly at all!)

For much of the C code I write, I have no idea what compiler most of my 
users are actually using. It has never occurred to me to ask. It has 
never occurred to me that the question might be interesting or the 
answer useful.

> so it might
> be a need that he used to have, and hasn't bothered to check whether
> it's still true. After all, he's comfortable restricting himself to a
> forward-compatible subset of C90, so why should he bother checking?

I used to use C for everything, but nowadays I /only/ use it when (a) I 
really do need portability between at least two disparate systems or 
when I have no idea what the users' implementations are, or (b) I'm 
writing tiny little CLI programs. For big GUI stuff, I use C++.

For CLI programs, I find the C90/C99 common subset (pace, C2011, if I 
spot any bits that I have to chop off to fit you in, I will indeed chop 
those bits off) to be so familiar that programming in it is easier and 
quicker than switching to C99 (or, nowadays, C11). Why switch if there's 
no need?

-- 
Richard Heathfield
Email: rjh at cpax dot org dot uk
"Usenet is a strange place" - dmr 29 July 1999
Sig line 4 vacant - apply within

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


Thread

Making sense of warning about "initialization makes pointer from integer without a cast" "Morten W. Petersen" <morphex@gmail.com> - 2015-10-04 04:40 +0200
  Re: Making sense of warning about "initialization makes pointer from integer without a cast" "Morten W. Petersen" <morphex@gmail.com> - 2015-10-04 04:59 +0200
    Re: Making sense of warning about "initialization makes pointer from integer without a cast" James Kuyper <jameskuyper@verizon.net> - 2015-10-03 23:23 -0400
    Re: Making sense of warning about "initialization makes pointer from integer without a cast" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-10-04 13:47 +0100
      Re: Making sense of warning about "initialization makes pointer from integer without a cast" Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-10-04 09:40 -0400
        Re: Making sense of warning about "initialization makes pointer from integer without a cast" "Morten W. Petersen" <morphex@gmail.com> - 2015-10-05 00:33 +0200
          Re: Making sense of warning about "initialization makes pointer from integer without a cast" James Kuyper <jameskuyper@verizon.net> - 2015-10-04 19:07 -0400
  Re: Making sense of warning about "initialization makes pointer from integer without a cast" Melzzzzz <mel@zzzzz.com> - 2015-10-04 05:08 +0200
  Re: Making sense of warning about "initialization makes pointer from integer without a cast" James Kuyper <jameskuyper@verizon.net> - 2015-10-03 23:16 -0400
    Re: Making sense of warning about "initialization makes pointer from integer without a cast" "Morten W. Petersen" <morphex@gmail.com> - 2015-10-04 05:23 +0200
      Re: Making sense of warning about "initialization makes pointer from integer without a cast" James Kuyper <jameskuyper@verizon.net> - 2015-10-03 23:34 -0400
        Re: Making sense of warning about "initialization makes pointer from integer without a cast" "Morten W. Petersen" <morphex@gmail.com> - 2015-10-04 05:50 +0200
          Re: Making sense of warning about "initialization makes pointer from integer without a cast" James Kuyper <jameskuyper@verizon.net> - 2015-10-04 13:49 -0400
            Re: Making sense of warning about "initialization makes pointer from integer without a cast" Richard Heathfield <rjh@cpax.org.uk> - 2015-10-04 19:11 +0100
              Re: Making sense of warning about "initialization makes pointer from integer without a cast" James Kuyper <jameskuyper@verizon.net> - 2015-10-04 15:12 -0400
                Re: Making sense of warning about "initialization makes pointer from integer without a cast" Richard Heathfield <rjh@cpax.org.uk> - 2015-10-04 20:52 +0100
                Re: Making sense of warning about "initialization makes pointer from integer without a cast" supercat@casperkitty.com - 2015-10-04 13:18 -0700
            Re: Making sense of warning about "initialization makes pointer from integer without a cast" "Morten W. Petersen" <morphex@gmail.com> - 2015-10-05 00:26 +0200
              Re: Making sense of warning about "initialization makes pointer from integer without a cast" Keith Thompson <kst-u@mib.org> - 2015-10-04 18:09 -0700
                Re: Making sense of warning about "initialization makes pointer from integer without a cast" supercat@casperkitty.com - 2015-10-04 19:55 -0700
      Re: Making sense of warning about "initialization makes pointer from integer without a cast" Keith Thompson <kst-u@mib.org> - 2015-10-04 15:10 -0700
  Re: Making sense of warning about "initialization makes pointer from integer without a cast" Geoff <geoff@invalid.invalid> - 2015-10-03 22:04 -0700
    Re: Making sense of warning about "initialization makes pointer from integer without a cast" "Morten W. Petersen" <morphex@gmail.com> - 2015-10-04 07:07 +0200
      Re: Making sense of warning about "initialization makes pointer from integer without a cast" Geoff <geoff@invalid.invalid> - 2015-10-03 23:29 -0700
  Re: Making sense of warning about "initialization makes pointer from   integer without a cast" Ian Collins <ian-news@hotmail.com> - 2015-10-04 19:18 +1300
  Re: Making sense of warning about "initialization makes pointer from integer without a cast" Siri Cruz <chine.bleu@yahoo.com> - 2015-10-03 23:29 -0700

csiph-web