|
Hello everyone,
I have searched and found the term automatic variable means function local variable, compared with static and global variable. Is that correct?
thanks in advance,
George
|
|
|
|
|
|
Hi gleat,
Sorry that I can not open the page, can you help to post some information here please?
regards,
George
|
|
|
|
|
Sure. Here it is:
<quote>
Automatic variables are variables local to a block. They are automatically allocated on the stack when that block of code is entered. When the block exits, the variables are automatically deallocated. Note that automatic variables are often called local variables.
The C storage class for automatic variables is auto; however auto is assumed unless otherwise specified. The basic syntax used to declare automatic variables in C is as follows
[storage_class] data_type variable_1, variable_2, ... variable_n;
An automatic variable will have an undefined value when declared, so it is good practice to initialize it with a valid value before using it.
</quote>
|
|
|
|
|
Great description, gleat!
regards,
George
|
|
|
|
|
George_George wrote: Sorry that I can not open the page
why that ? it's a link to the MSDN, and you often post on the MSDN forum, don't you ?!
bah, yet another lazy crappy poster
|
|
|
|
|
a variable can be declared auto matic, such as static or register .
auto matic is the implicit type when you declare a variable without specifying this statement.
for information, register will ask the compiler (but not force it to) place the variable into a processor register. this is for a variable that is often modified, to improve performances.
static has several meaning. here, we do not talk about the static on class members.
delcaring a variable static means that its value pertains wether the execution goes out of scope. out of the scope, the variable is not destroyed (thus keeping its last value for the next time the code is reexecuted), but not much accessible from outside.
auto matic simply means what we all know about variables lifetime. A variable is created at its declaration, is is release straight when going out of scope.
register double = 4.;
static char c = 'B';
auto int i1 = 3;
int i2 = -7;
|
|
|
|
|
Cool! I think your post is the most valuable which deserves rate 5.
have a good weekend,
George
|
|
|
|
|
|
It appears so, but he is still keeping his age a secret.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What are the odds he's not as old as you or as ugly as me?
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
See here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
Good learning resource.
regards,
George
|
|
|
|
|
Hi,
days ago I post a question that has not been answered.
This is the question[^]
If you don't mind... I would like to have an answer, although it says "message too long, bad explained, there is no solution... ", of course I would prefer a tip, or something that help me to resolve it.
-- modified at 4:59 Friday 9th November, 2007
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Hi All,
What enum in VC++ 6.0 is equivalent to LinearGradientMode (VC++.Net)?
|
|
|
|
|
Do you need to GRADIENT_FILL_RECT_V or GRADIENT_FILL_RECT_H for set gradient mode?
|
|
|
|
|
The GDI+ Brush can do linear gradients.
|
|
|
|
|
Since VC++.Net (GDI+) has LinearGradientBrush and LinearGradientMode, i want equivalent methods in VC++ 6.0.
|
|
|
|
|
You can use GDI+ with Visual C++ 6.0
|
|
|
|
|
VC++ documentation tells, GetPrivateProfileSection is provided only for compatibility with 16-bit applications.
Can we use this function in VC++ .Net 2003?
Best Regards,
Suman
|
|
|
|
|
In the continue MSDN says that:"Applications should store initialization information in the registry."
|
|
|
|
|
rp_suman wrote: Can we use this function in VC++ .Net 2003?
Yes.
But you can alternatively use, as recommended, the registry.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi
I want to know, if some user is logged on the machine, this from a Win32 Service runing under LocalSystem Account...
Thk.
|
|
|
|
|
From MSDN:
Use WTSEnumerateSessions function to retrieve a list of sessions on a specified terminal server.
Or use WTSGetActiveConsoleSessionId function to retrieve the Terminal Services session currently attached to the physical console. The physical console is the monitor, keyboard, and mouse. Note that it is not necessary that Terminal Services be running for this function to succeed. Then use
WTSQueryUserToken function to obtain the primary access token of the logged-on user specified by the session ID. To call this function successfully, the calling application must be running within the context of the LocalSystem account and have the SE_TCB_NAME privilege. It is not necessary that Terminal Services be running for the function to succeed, but if Terminal Services is not running, the only valid session identifier is zero (0). Windows Vista and Windows Server "Longhorn" allow only services and processes started by services to run in session zero.
Caution WTSQueryUserToken is intended for highly trusted services. Service providers must use caution that they do not leak user tokens when calling this function. Service providers must close token handles after they have finished with them.
|
|
|
|
|
it was just what I need... thk
SOAD
|
|
|
|