This is a discussion on Re: one element array as name of structure typedef - C ; On Sep 4, 7:14 pm, "Ron Peterson (012ED25E)" <peterson....@gmail.com> wrote: > I ran into a typedef for a structure recently that looks like this: > > typedef struct { > int len; > char *buf; > > } foo[1]; > ...
On Sep 4, 7:14 pm, "Ron Peterson (012ED25E)" <peterson....@gmail.com>
wrote:
> I ran into a typedef for a structure recently that looks like this:
>
> typedef struct {
> int len;
> char *buf;
>
> } foo[1];
>
> This is basically an abbreviation of something I found in the GNU MP
> library. I was looking for this, because I wanted to understand how
> their mpz_t type worked.
>
> Anyway, I'm not familiar with the idea of using a one element array as
> the name of a typedef. Is there a name for this type of construct?
> Is it standard portable C?
Yes, it's standard C. In the same way, you can define a typedef
typedef char short_buf [5];
for a small 5 element char array.
Michael
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.