Ah yes. Good point.
On our embedded system I wrote stddef.h and didn’t quite get it right J
Thanks
Neil
From:
lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of Paul Hudson
Sent: 22 February 2010 12:26
To: Lua list
Subject: Re: Problem with lstrlib.c
> On our system, ptrdiff_t is unsigned
long.
Your system isn't ANSI C. I would expect this breaks quite a number of
programs.
"When two pointers are subtracted, both shall point to elements of the
same array object, or one past the last element of the array object; the result
is the difference of the subscripts of the two array elements. The size of the
result is implementation-defined, and its type (a signed integer type) is ptrdiff_t defined in the <stddef.h> header."
(Not got the standard in front of me, but it's quoted from here: http://stackoverflow.com/questions/1645669/char-a-b-what-type-is-b-a-and-how-do-i-printf-it)
This e-mail and any files transmitted with it ("E-mail") is intended solely for the addressee(s)
and may contain confidential and/or legally privileged information. If you are not the addressee(s), any
disclosure, reproduction, copying, distribution or other use of the E-mail is prohibited. If you have received
this E-mail in error, please delete it and notify the sender immediately via our switchboard or return e-mail.
Neither the company nor any subsidiary or affiliate or associated company nor any individual sending this E-mail
accepts any liability in respect of the content (including errors and omissions) nor shall this e-mail be deemed
to enter the company or any subsidiary or affiliate or associated company into a contract or to create any
legally binding obligations unless expressly agreed to in writing under separate cover and timeliness of the
E-mail which arise as a result of transmission. If verification is required, please request a hard copy version
from the sender.