Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 08 Dec 2000 13:09:57 -0800
From:      Mike Smith <msmith@freebsd.org>
To:        wpaul@FreeBSD.ORG (Bill Paul)
Cc:        wkb@freebie.demon.nl (Wilko Bulte), jhb@FreeBSD.ORG, alpha@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/alpha/conf GENERIC 
Message-ID:  <200012082109.eB8L9vF02129@mass.osd.bsdi.com>
In-Reply-To: Your message of "Fri, 08 Dec 2000 12:56:02 PST." <20001208205603.C401D37B404@hub.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> While looking over the code, something jumped out at me. In
> epic_common_attach(), we have this:
> 
>         i = sizeof(struct epic_frag_list)*TX_RING_SIZE +
>             sizeof(struct epic_rx_desc)*RX_RING_SIZE + 
>             sizeof(struct epic_tx_desc)*TX_RING_SIZE + PAGE_SIZE,
>         sc->pool = (epic_softc_t *) malloc( i, M_DEVBUF, M_NOWAIT);
> 
> There are two C statements here: one to assign a value to i, and another
> to malloc() i bytes worth of space and leave the address of the buffer
> in sc->pool. Except the first statement doesn't end with a semicolon.
> 
> How is this not a syntax error?

Because there's a comma between the two statements.

	i = 10, j = malloc(i);

is a legal expression which returns 10.  The comma operator really only 
exists for things like

	for (i = 0, j = 0; ...

but you do find it abused occasionally by someone that thinks they're 
being smart or funny.

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200012082109.eB8L9vF02129>