Click here to Skip to main content
16,011,374 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: SnapShot Pin
erkanina7-Jul-04 22:48
erkanina7-Jul-04 22:48 
GeneralRe: SnapShot Pin
Liger_Zero_X8-Jul-04 0:49
Liger_Zero_X8-Jul-04 0:49 
GeneralRe: SnapShot Pin
ThatsAlok8-Jul-04 1:30
ThatsAlok8-Jul-04 1:30 
GeneralRe: SnapShot Pin
Liger_Zero_X8-Jul-04 16:59
Liger_Zero_X8-Jul-04 16:59 
GeneralRe: SnapShot Pin
Liger_Zero_X8-Jul-04 21:21
Liger_Zero_X8-Jul-04 21:21 
GeneralRe: SnapShot Pin
Liger_Zero_X8-Jul-04 22:47
Liger_Zero_X8-Jul-04 22:47 
GeneralQuestions on the keyword "register" in C & C++ Pin
Link26007-Jul-04 15:56
Link26007-Jul-04 15:56 
GeneralRe: Questions on the keyword "register" in C & C++ Pin
Ryan Binns7-Jul-04 16:31
Ryan Binns7-Jul-04 16:31 
Alex Ngai wrote:
However, as I tried to do the same thing in C++, it runs and printed a memory address!!

In C++, if you take the address of a register variable, then the compiler will automatically make the variable a non-register variable, assuming it was ever going to be one in the first place...

Alex Ngai wrote:
So how do I know if it will be put in CPU's register?

It won't. The MS VC++ compiler does not take any notice of the register keyword.

Alex Ngai wrote:
What is the purpose of the keyword register if it won't do what it is supposed to do?

There is none. These days the compilers optimise well enough that if they honoured your request for a register variable, the program may actually run slower.

Alex Ngai wrote:
I remember during a programming class, I was taught that X86 architecture has 8 registers. Since most CPU are using X86 architecture including intel P4, I wonder if P4 also only has 8 registers?

The x86 architecture has more than 8 registers. Starting with the 80286 there are AH & AL (AX), BH & BL (BX), CH & CL (CX), DH & DL (DX), CS, DS, ES, SS, SP, BP, IP (not directly addressable), SI, DI, FLAGS and MSW. The 80386 and later extend the registers to 32-bits (other than CS, DS, ES and SS) and also add FS, GS, DR0, DR1, DR2, DR3, TR, GDTR and LDTR. The 80486 and later add the FPU registers ST(0) through ST(7). Not much changes then until MMX, which added MM0 through MM7 (shared with the FPU registers). Here is where my knowledge dries up Frown | :( but I know that SSE and SSEII add more registers as well. Later processors may add other registers, but I'm not certain. So the P4 has lots of registers, some used for special purposes, but about half of them can be used as general purpose registers.

Alex Ngai wrote:
I have heard that VS.Net 03 has a way to optimize for the P4, so how do I do that?

Not sure, never used it. Sorry...

Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

GeneralRe: Questions on the keyword "register" in C & C++ Pin
Paul Ranson8-Jul-04 0:00
Paul Ranson8-Jul-04 0:00 
GeneralRe: Questions on the keyword "register" in C & C++ Pin
Link26008-Jul-04 13:39
Link26008-Jul-04 13:39 
GeneralRe: Questions on the keyword "register" in C & C++ Pin
Paul Ranson9-Jul-04 0:47
Paul Ranson9-Jul-04 0:47 
GeneralC++ questions - memory allocation speed and using an instance of a class Pin
Indrawati7-Jul-04 14:04
Indrawati7-Jul-04 14:04 
GeneralRe: C++ questions - memory allocation speed and using an instance of a class Pin
palbano7-Jul-04 16:58
palbano7-Jul-04 16:58 
GeneralHelp managing test code Pin
Gavin Stark7-Jul-04 14:04
Gavin Stark7-Jul-04 14:04 
QuestionDont lose focus? Pin
Larsson7-Jul-04 13:16
Larsson7-Jul-04 13:16 
AnswerRe: Dont lose focus? Pin
Ken Mazaika7-Jul-04 13:34
Ken Mazaika7-Jul-04 13:34 
GeneralRe: Dont lose focus? Pin
Larsson7-Jul-04 13:37
Larsson7-Jul-04 13:37 
GeneralRe: Dont lose focus? Pin
Ken Mazaika7-Jul-04 13:42
Ken Mazaika7-Jul-04 13:42 
GeneralRe: Dont lose focus? Pin
Larsson7-Jul-04 13:44
Larsson7-Jul-04 13:44 
GeneralRe: Dont lose focus? Pin
Ken Mazaika7-Jul-04 13:51
Ken Mazaika7-Jul-04 13:51 
GeneralRe: Dont lose focus? Pin
Larsson7-Jul-04 13:54
Larsson7-Jul-04 13:54 
AnswerRe: Dont lose focus? Pin
ThatsAlok7-Jul-04 21:56
ThatsAlok7-Jul-04 21:56 
GeneralDialog Box Pin
Ken Mazaika7-Jul-04 13:06
Ken Mazaika7-Jul-04 13:06 
GeneralCommand line arguments.. Pin
Laing,James7-Jul-04 12:17
Laing,James7-Jul-04 12:17 
GeneralRe: Command line arguments.. Pin
Graham Bradshaw7-Jul-04 12:32
Graham Bradshaw7-Jul-04 12:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.