473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Default type for "register" variable

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

Sep 1 '07 #1
3 1913
On Sep 1, 3:24 pm, "ose" <os...@hotmail.comwrote:
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

Sep 1 '07 #2

"Robert Gamble" <rg*******@gmail.comwrote in message
news:11**********************@57g2000hsv.googlegro ups.com...
On Sep 1, 3:24 pm, "ose" <os...@hotmail.comwrote:
>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

Sep 1 '07 #3
>>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.

Sep 2 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex | last post by:
I apoligise in advance if this is an os or platform based question, I don't know. I was wondering how register integers (and other types of register variables) are managed by c++. For example,...
13
by: Shankar Agarwal | last post by:
I was trying to use a variable whose value is temporary and i don't want it to go to the memory for performance reasons. Is there a way to specify the variable like that so that any assignment to...
65
by: Spiros Bousbouras | last post by:
Has anyone found that declaring variables register affected speed of execution ? If yes on what hardware and around which year ?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.