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


Groups > comp.lang.c > #109523

Re: error: initializer element is not constant|

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: error: initializer element is not constant|
Date 2017-05-08 11:37 -0700
Organization None to speak of
Message-ID <ln1srzb3fj.fsf@kst-u.example.com> (permalink)
References (3 earlier) <gmXPA.1653357$Pm3.1121619@fx42.am4> <oepglk$1vlt$1@gioia.aioe.org> <ufYPA.134876$QR.27637@fx34.am4> <lny3u7baod.fsf@kst-u.example.com> <vl1QA.2026$Aj7.512@fx33.am4>

Show all headers | View raw


bartc <bc@freeuk.com> writes:
> On 08/05/2017 17:00, Keith Thompson wrote:
[...]
>> I think you meant that arrays of pointers to arrays would be unusual.
>
> No, I mean arrays of pointers to strings, with a string meaning char*. 
> The variable names I've chosen should make it clear that:
>
>    str (ie. string) is a char*
>    ptr_to_str is char**
>
> and so on.

Then you are using terminology that is clearly defined by the C standard
in a manner inconsistent with the way the standard uses it.

> Since it is impossible to work with an actual string itself, it's more 
> useful I think for 'string' to be a synonym for 'char*'.

Whether it would have been more useful or not, the standard clearly
defines the terms "string" and "pointer to string" in 7.1.1p1, which
I've recently quoted elsewhere in this thread.

>> A "pointer to a string" is by definition a pointer to the initial
>> character of a string.
>
> AFAIK C has no such concept.

Well now you know that it does.

>                              It only has pointer to char. Or, rarely, a 
> pointer to an entire array, of which the contents may contain a 
> zero-terminated string.

One more time, N1570 7.1.1p1 (with asterisks to represent italics, which
denote a definition of a term):

    A *string* is a contiguous sequence of characters terminated
    by and including the first null character. The term *multibyte
    string* is sometimes used instead to emphasize special processing
    given to multibyte characters contained in the string or to
    avoid confusion with a wide string. A *pointer to a string*
    is a pointer to its initial (lowest addressed) character.

Feel free to dislike those definitions, but at least consider
acknowledging their existence in the C standard.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


Thread

error: initializer element is not constant| jak <please@nospam.tnx> - 2017-05-08 09:55 +0200
  Re: error: initializer element is not constant| jak <please@nospam.tnx> - 2017-05-08 10:05 +0200
  Re: error: initializer element is not constant| Noob <root@127.0.0.1> - 2017-05-08 10:38 +0200
    Re: error: initializer element is not constant| jak <please@nospam.tnx> - 2017-05-08 11:55 +0200
      Re: error: initializer element is not constant| bartc <bc@freeuk.com> - 2017-05-08 11:01 +0100
        Re: error: initializer element is not constant| jak <please@nospam.tnx> - 2017-05-08 12:18 +0200
          Re: error: initializer element is not constant| bartc <bc@freeuk.com> - 2017-05-08 12:02 +0100
            Re: error: initializer element is not constant| Keith Thompson <kst-u@mib.org> - 2017-05-08 09:00 -0700
              Re: error: initializer element is not constant| bartc <bc@freeuk.com> - 2017-05-08 17:50 +0100
                Re: error: initializer element is not constant| Keith Thompson <kst-u@mib.org> - 2017-05-08 11:37 -0700
                Re: error: initializer element is not constant| bartc <bc@freeuk.com> - 2017-05-08 19:49 +0100
                Re: error: initializer element is not constant| Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-08 20:13 +0100
                Re: error: initializer element is not constant| Keith Thompson <kst-u@mib.org> - 2017-05-08 12:44 -0700
                Re: error: initializer element is not constant| scott@slp53.sl.home (Scott Lurndal) - 2017-05-08 20:24 +0000
            Re: error: initializer element is not constant| jak <please@nospam.tnx> - 2017-05-09 09:54 +0200
              Re: error: initializer element is not constant| jak <please@nospam.tnx> - 2017-05-09 10:15 +0200
              Re: error: initializer element is not constant| GOTHIER Nathan <nathan.gothier@gmail.com> - 2017-05-09 12:12 +0200
              Re: error: initializer element is not constant| bartc <bc@freeuk.com> - 2017-05-09 11:47 +0100
                Re: error: initializer element is not constant| jak <please@nospam.tnx> - 2017-05-09 19:06 +0200
                Re: error: initializer element is not constant| scott@slp53.sl.home (Scott Lurndal) - 2017-05-09 17:10 +0000
                Re: error: initializer element is not constant| jak <please@nospam.tnx> - 2017-05-09 19:20 +0200
                Re: error: initializer element is not constant| Barry Schwarz <schwarzb@dqel.com> - 2017-05-09 10:35 -0700
                Re: error: initializer element is not constant| jak <please@nospam.tnx> - 2017-05-09 20:04 +0200
                Re: error: initializer element is not constant| Keith Thompson <kst-u@mib.org> - 2017-05-09 11:57 -0700
                Re: error: initializer element is not constant| supercat@casperkitty.com - 2017-05-09 12:50 -0700
                Re: error: initializer element is not constant| Keith Thompson <kst-u@mib.org> - 2017-05-09 12:54 -0700
                Re: error: initializer element is not constant| bartc <bc@freeuk.com> - 2017-05-09 20:15 +0100
                Re: error: initializer element is not constant| "James R. Kuyper" <jameskuyper@verizon.net> - 2017-05-09 14:13 -0400
                Re: error: initializer element is not constant| Keith Thompson <kst-u@mib.org> - 2017-05-09 11:41 -0700
              Re: error: initializer element is not constant| Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-09 12:16 +0100
              Re: error: initializer element is not constant| Keith Thompson <kst-u@mib.org> - 2017-05-09 08:11 -0700
          Re: error: initializer element is not constant| Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-08 12:12 +0100
            Re: error: initializer element is not constant| bartc <bc@freeuk.com> - 2017-05-08 13:45 +0100
              Re: error: initializer element is not constant| Keith Thompson <kst-u@mib.org> - 2017-05-08 09:04 -0700
              Re: error: initializer element is not constant| Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-05-08 19:53 +0100
                Re: error: initializer element is not constant| bartc <bc@freeuk.com> - 2017-05-08 20:44 +0100
                Re: error: initializer element is not constant| Noob <root@127.0.0.1> - 2017-05-09 09:27 +0200
              Re: error: initializer element is not constant| Tim Rentsch <txr@alumni.caltech.edu> - 2017-05-09 07:10 -0700
            Re: error: initializer element is not constant| Keith Thompson <kst-u@mib.org> - 2017-05-08 09:30 -0700
  Re: error: initializer element is not constant| John Bode <jfbode1029@gmail.com> - 2017-05-08 08:05 -0700

csiph-web