[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: io.format (was: Reported to the Bloat Police: string.pack, .unpack and .packsize!)
- From: Daurnimator <quae@...>
- Date: Mon, 24 Aug 2015 10:09:21 +1000
On 24 August 2015 at 04:59, Sean Conner <sean@conman.org> wrote:
> And I still have to play around with syntax when I want to use ... and I
> keep forgetting the name ... anonymous pointers?
>
> rc = setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(int){1},sizeof(int));
>
> instead of
>
> int opt = 1;
> rc = setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,&opt,sizeof(int));
>
> Annoying, but I live with it.
>
> -spc
"compound literal" is the term you're looking for.
They're very useful :)
For setsockopt you'll need to take the address of your compound literal:
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int));