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


Groups > comp.lang.c > #94732

Re: C language declaration "bugs"

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: C language declaration "bugs"
Date 2016-10-11 10:01 -0700
Organization None to speak of
Message-ID <ln60oyom5l.fsf@kst-u.example.com> (permalink)
References <90bf0ba6-5094-4551-8cc0-c60214b14362@googlegroups.com> <87d1j7avp8.fsf@bsb.me.uk> <b4976e0d-cedb-4721-a261-d3597eb43b97@googlegroups.com> <87zimb9e5b.fsf@bsb.me.uk>

Show all headers | View raw


Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Thiago Adams <thiago.adams@gmail.com> writes:
[...]
>> I can't find any options to express dynamic arrays in structs.
>
> No, you can't, other than the "struct hack" of putting a flexible array
> member (i.e. an incomplete array declaration) as the last member.

I think the term "struct hack" generally refers to the old technique of
defining an array member of length 0 or 1 at the end of a structure and
treating it as a longer array.  Flexible array members, added in C99,
were intended to *replace* the struct hack.

-- 
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

C language declaration "bugs" Thiago Adams <thiago.adams@gmail.com> - 2016-10-11 05:17 -0700
  Re: C language declaration "bugs" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-11 13:58 +0100
    Re: C language declaration "bugs" Thiago Adams <thiago.adams@gmail.com> - 2016-10-11 06:47 -0700
      Re: C language declaration "bugs" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-11 15:03 +0100
        Re: C language declaration "bugs" Thiago Adams <thiago.adams@gmail.com> - 2016-10-11 07:41 -0700
          Re: C language declaration "bugs" BartC <bc@freeuk.com> - 2016-10-11 16:31 +0100
        Re: C language declaration "bugs" Keith Thompson <kst-u@mib.org> - 2016-10-11 10:01 -0700
          Re: C language declaration "bugs" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-10-11 19:10 +0100
  Re: C language declaration "bugs" BartC <bc@freeuk.com> - 2016-10-11 14:14 +0100

csiph-web