![]() |
Default type for "register" variable
When the type specifier is missing for variable "register i", what's the
default type assumed in C? int redian(int Max) { register i; for (i = 1; i <= Max; i++) ... } |
Re: Default type for "register" variable
On Sep 1, 3:24 pm, "ose" <os...@hotmail.com> wrote:
> When the type specifier is missing for variable "register i", what's the > default type assumed in C? > > int redian(int Max) > { > register i; > > for (i = 1; i <= Max; i++) > ... > > } The type defaults to int in C89, in C99 it is an error. Robert Gamble |
Re: Default type for "register" variable
"Robert Gamble" <rgamble99@gmail.com> wrote in message news:1188675285.292033.316730@57g2000hsv.googlegro ups.com... > On Sep 1, 3:24 pm, "ose" <os...@hotmail.com> wrote: >> When the type specifier is missing for variable "register i", what's the >> default type assumed in C? >> >> int redian(int Max) >> { >> register i; >> >> for (i = 1; i <= Max; i++) >> ... >> >> } > > The type defaults to int in C89, in C99 it is an error. > That could be a way of getting rid of size_t. Default to a size_t in C 2007. -- Free games and programming goodies. http://www.personal.leeds.ac.uk/~bgy1mm |
Re: Default type for "register" variable
>>> When the type specifier is missing for variable "register i", what's the
>>> default type assumed in C? >>> >>> int redian(int Max) >>> { >>> register i; >>> >>> for (i = 1; i <= Max; i++) >>> ... >>> >>> } >> >> The type defaults to int in C89, in C99 it is an error. >> >That could be a way of getting rid of size_t. Default to a size_t in C 2007. Why would you want to make that a default type? Why not something more useful, say, a function pointer? Or an array of 3 doubles? In any case, it's preferable to explicitly state the type, as otherwise you have silent breakage if the code is compiled with an older version of C. |
| All times are GMT. The time now is 12:02 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.