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

**To**:**Alan Barrett <apb%cequrux.com@localhost>****Subject**:**Re: proposal: some pointer and arithmetic utilities****From**:**Steffen "Daode" Nurpmeso <sdaoden%gmail.com@localhost>**- Date: Fri, 22 Mar 2013 10:58:05 +0100

Alan Barrett <apb%cequrux.com@localhost> wrote: |I don't really see the point of offsetin -- if you have a struct |that ends with an array of 1 element, but you want to allocate |enough space for the struct plus an array of >1 elements, then why |not just do the arithmetic without a macro, and if you do need a |macro, then why not give it a name that sounds more like "sizeof"? Hm - my reading of C99 is that using array[1] as a base of a variable-sized array has become undefined behaviour (Annex J, 2., "Addition or subtraction of a pointer [.] produces a result that does not point into, or just beyond, the same array object"). Since todays compilers over-optimize so aggressively i indeed became so frightened that i only use the [] notation, i think it's called "flexible array" or something. --steffen

**References**:**proposal: some pointer and arithmetic utilities***From:*Taylor R Campbell

**Re: proposal: some pointer and arithmetic utilities***From:*Taylor R Campbell

**Re: proposal: some pointer and arithmetic utilities***From:*Alan Barrett

- Prev by Date:
**Re: proposal: some pointer and arithmetic utilities** - Next by Date:
**Re: proposal: some pointer and arithmetic utilities** - Previous by Thread:
**Re: proposal: some pointer and arithmetic utilities** - Next by Thread:
**Re: proposal: some pointer and arithmetic utilities** - Indexes: