bringing tzcode in the ANSI era
Thanks Paul for the ANSI prototypes, now can we please 's/register //g'? It is not adding any value... christos
...can we please 's/register //g'? It is not adding any value...
Declaring something with "register" means it doesn't have an address and that its value can't be changed by way of a pointer; the declaration can be both a hint to the compiler and a mental aid for aging humans (such as yours truly). --ado
On 26/10/12 12:10, Arthur David Olson wrote:
...can we please 's/register //g'? It is not adding any value...
Declaring something with "register" means it doesn't have an address and that its value can't be changed by way of a pointer; the declaration can be both a hint to the compiler and a mental aid for aging humans (such as yours truly).
Or possibly a hindrance to the compiler. Didn't 'register' go out of fashion back in the 90s? -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
On Fri, Oct 26, 2012, at 09:20, Ian Abbott wrote:
Or possibly a hindrance to the compiler. Didn't 'register' go out of fashion back in the 90s?
Compilers are typically smart enough these days to ignore it if that will be the case. If you're worried about it, you could simply #define register to remove it. -- Random832
Ian Abbott wrote:
On 26/10/12 12:10, Arthur David Olson wrote:
...can we please 's/register //g'? It is not adding any value...
Declaring something with "register" means it doesn't have an address and that its value can't be changed by way of a pointer; the declaration can be both a hint to the compiler and a mental aid for aging humans (such as yours truly).
Or possibly a hindrance to the compiler. Didn't 'register' go out of fashion back in the 90s?
Indeed. Compilers today are generally better than humans at deciding what variables should be stored in registers. Modern compilers even ignore the 'register' hint I think. +1 for removing the 'register' keywords. -- Dominique
On 10/26/2012 04:10 AM, Arthur David Olson wrote:
the declaration can be both a hint to the compiler and a mental aid for aging humans (such as yours truly).
These days 'register' typically doesn't help the compiler. I just now built the 2012g distribution on my platform (Fedora 17 x86-64, GCC 4.7.2) and the code was the same regardless of whether I compiled with '-Dregister='. The mental aid for aging humans is more important, and is an issue that I'm sympathetic to, as I'm aging myself. To be honest I find that 'register' hurts my understanding of the code a bit more than it helps. Its cost is noise that slows me down when I'm trying to figure out what the code actually does; its benefit is that it tells me that the address of a local is never taken. To my eyes the cost is small but the benefit is even smaller: I can easily determine myself whether the address is taken on the rare occasions when I need or want to know that. If you continue to find 'register' useful, I'd rather leave it in, as its cost in readability is pretty small, at least to my eyes. It might help to put in a comment summarizing the above, though, in case the issue comes up again -- maybe in README?
On Oct 26, 9:55am, eggert@cs.ucla.edu (Paul Eggert) wrote: -- Subject: Re: [tz] bringing tzcode in the ANSI era | The mental aid for aging humans is more important, and is an | issue that I'm sympathetic to, as I'm aging myself. To be | honest I find that 'register' hurts my understanding of the | code a bit more than it helps. Its cost is noise that slows | me down when I'm trying to figure out what the code actually | does; its benefit is that it tells me that the address of a | local is never taken. To my eyes the cost is small but the | benefit is even smaller: I can easily determine myself | whether the address is taken on the rare occasions when I | need or want to know that. I am sorry, but I find the register keyword abuse to forbid taking the address of a variable of questionable use. At the very least if the consensus is to keep it the way it is now, then we should add it to all the variables in the code we are not taking the address of, otherwise its use is inconsistent. I would prefer that time is spent in more useful endeavors such as: - fixing the library to not core-dump internally eg: asctime(localtime(timep)) - set errno to useful values on failure, and document it - add reentrant functions and locking for the non-reentrant ones - move the man pages to -mdoc instead of -man so we can generate HTML etc from them - make the git repository available - make the tar files create a directory like everything else these days Many of those changes are in NetBSD. christos
participants (6)
-
Arthur David Olson -
christos@zoulas.com -
Dominique Pellé -
Ian Abbott -
Paul Eggert -
random832@fastmail.us