Re: pointers and determining array size and weird code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Le Mon, 1 Oct 2007 06:41:46 -0400 (EDT),
"Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx> a écrit :

>   so ELEMCOUNT() is clearly just an alternative to the more common
> ARRAY_SIZE() macro.  but calling the macro SCTP_CHUNKMAP_IS_CLEAR()
> pretty clearly assumes that you can determine the array size of the
> macro parameter "chunkmap".  however, from the source file
> net/netfilter/xt_sctp.c, we have:

Yup, looks strange.

> i don't see how you can reasonably call the macro
> SCTP_CHUNKMAP_IS_CLEAR() with a *pointer* to an array and expect that
> macro to be able to determine the "size" of that array.  AFAIK,
> wouldn't you just get the answer "1" as the alleged size?

Could be 0 too, if the size of an element of the array is bigger than
the size of an integer.

Sincerly,

Thomas
-- 
Thomas Petazzoni - thomas.petazzoni@xxxxxxxx
http://{thomas,sos,kos}.enix.org - http://www.toulibre.org
http://www.{livret,agenda}dulibre.org

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux