Default type for "register" variable

O

ose

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++)
...
}
 
R

Robert Gamble

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
 
M

Malcolm McLean

Robert Gamble said:
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.
 
G

Gordon Burditt

When the type specifier is missing for variable "register i", what's the
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top