C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-03-2009, 12:24 PM   #1
Registered User
 
Join Date: Nov 2009
Posts: 1
Question variable stored in register or not ???

I stumbled at an assignment that

"How do we get to know whether variable stored in register or not, programmatically ?"

Please give me any idea, If anyone already done this one.

Thanks in Advance
Srikanth Dhondi

Last edited by dhondi; 11-03-2009 at 12:29 PM.
dhondi is offline   Reply With Quote
Old 11-03-2009, 12:25 PM   #2
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,768
Quote:
Originally Posted by dhondi View Post
I know how to use storage classes well, I have an assignment that

"How do we get to know whether variable stored in register or not, programmatically ?"

Thanks in Advance
Srikanth Dhondi
You don't have any way of knowing that. What does "programmatically" mean in this context?
__________________
"Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot
brewbuck is offline   Reply With Quote
Old 11-03-2009, 12:35 PM   #3
Registered User
 
Join Date: Jan 2009
Posts: 224
There is a storage class specifier called register, but as far as I know that only works as a suggestion for the compiler, ie it may not be stored in a register anyway.
Subsonics is offline   Reply With Quote
Old 11-03-2009, 01:03 PM   #4
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
The only way of knowing it is looking at the assembly of the compiled code. It is impossible to do programatically, if it means finding out so via code. Remember that C knows nothing about the process architecture or its registers. It is simply a high-level language that is translated into instructions for the cpu.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Reply

Tags
stored in register, variable

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
static class variable vs. global variable nadamson6 C++ Programming 18 09-30-2005 03:31 PM
variable being reset FoodDude C++ Programming 1 09-15-2005 12:30 PM
pointers InvariantLoop C Programming 13 02-04-2005 09:32 AM
Problem with a char variable set as a letter 7smurfs C++ Programming 6 12-10-2004 01:25 PM
creating class, and linking files JCK C++ Programming 12 12-08-2002 02:45 PM


All times are GMT -6. The time now is 07:06 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22