Click here to Skip to main content
15,892,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CStdioFile problem Pin
lisoft6-Apr-08 18:47
lisoft6-Apr-08 18:47 
GeneralRe: CStdioFile problem Pin
nisha000006-Apr-08 19:40
nisha000006-Apr-08 19:40 
GeneralRe: CStdioFile problem Pin
krmed7-Apr-08 1:50
krmed7-Apr-08 1:50 
GeneralRe: CStdioFile problem Pin
lisoft7-Apr-08 15:18
lisoft7-Apr-08 15:18 
GeneralRe: CStdioFile problem Pin
krmed8-Apr-08 0:47
krmed8-Apr-08 0:47 
GeneralRe: CStdioFile problem Pin
Hamid_RT8-Apr-08 7:21
Hamid_RT8-Apr-08 7:21 
GeneralOn implementing a virtual keyboard Pin
Llasus6-Apr-08 16:10
Llasus6-Apr-08 16:10 
QuestionWhere Does a static attribute reside in a Object ?? Pin
ForNow6-Apr-08 15:57
ForNow6-Apr-08 15:57 
Hi,

As MainFramer I knowing that knowing Assembler always helped understand concepts

Anyway to the point I wrote some inline _asm code in a Method

In order to access the data in the Class I realized that the "this"

pointer (pointer to the object) resides on the stack after

paramter variables

I also relized when trying to initilize data with static that I had

to do it in the program

Why ??? the storage for static attribue members do not reside in the

Object rather in the program

This point was further driven home in my _asm code I tried to

access the data the way it was documented on the MSDN page

following is the the code from the MSDN web page

InlineAssembler_Accessing_C_asm_Blocks.cpp
// processor: x86
#include <stdio.h>
struct first_type
{
char *weasel;
int same_name;
};

struct second_type
{
int wonton;
long same_name;
};

int main()
{
struct first_type hal;
struct second_type oat;

__asm
{
lea ebx, hal
mov ecx, [ebx]hal.same_name ; Must use 'hal'
mov esi, [ebx].weasel ; Can omit 'hal'
}
return 0;

I used the following code to access the data in a my Class

First a example of my class


class MYClass
{
private:
static char *c;
static int d;
public:
.
.
.
etc

Now My _asm code

void MYClass :: class(int a, int b)
{
_asm
{
mov ebx,DWORD PTR 16[ebp] ; get this pointer
lea esi,[ebx].d

I got a compile/assemble error when "d" os declared as static

: error C2411: 'd' : illegal struct/union member in 'second operand'

Makes sense becuase when d is declared as static the storage doesn't

reside in the Object


So Whats my question ????

If I use the static attribute how can I access it in _asm code


Thankx
AnswerRe: Where Does a static attribute reside in a Object ?? Pin
Dan6-Apr-08 17:53
Dan6-Apr-08 17:53 
GeneralRe: Where Does a static attribute reside in a Object ?? Pin
ForNow7-Apr-08 15:52
ForNow7-Apr-08 15:52 
GeneralFile Access Privileges Pin
Richard Andrew x646-Apr-08 15:56
professionalRichard Andrew x646-Apr-08 15:56 
Generallink adatabase to adialog based application Pin
lahom6-Apr-08 12:29
lahom6-Apr-08 12:29 
GeneralRe: link adatabase to adialog based application Pin
Hamid_RT8-Apr-08 7:21
Hamid_RT8-Apr-08 7:21 
Generaldrawing a cercle by code [modified] Pin
Schehaider_Aymen6-Apr-08 9:42
Schehaider_Aymen6-Apr-08 9:42 
GeneralRe: drawing a cercle by code Pin
Mark Salsbery6-Apr-08 11:04
Mark Salsbery6-Apr-08 11:04 
GeneralRe: drawing a cercle by code Pin
Schehaider_Aymen6-Apr-08 11:05
Schehaider_Aymen6-Apr-08 11:05 
QuestionRe: drawing a cercle by code Pin
CPallini6-Apr-08 11:19
mveCPallini6-Apr-08 11:19 
GeneralRe: drawing a cercle by code Pin
Mark Salsbery6-Apr-08 11:21
Mark Salsbery6-Apr-08 11:21 
GeneralRe: drawing a cercle by code Pin
CPallini6-Apr-08 21:23
mveCPallini6-Apr-08 21:23 
GeneralRe: drawing a cercle by code Pin
Schehaider_Aymen6-Apr-08 11:23
Schehaider_Aymen6-Apr-08 11:23 
GeneralRe: drawing a cercle by code Pin
Mark Salsbery6-Apr-08 11:27
Mark Salsbery6-Apr-08 11:27 
GeneralRe: drawing a cercle by code Pin
Schehaider_Aymen6-Apr-08 11:29
Schehaider_Aymen6-Apr-08 11:29 
GeneralRe: drawing a cercle by code Pin
Schehaider_Aymen6-Apr-08 11:32
Schehaider_Aymen6-Apr-08 11:32 
GeneralRe: drawing a cercle by code Pin
Mark Salsbery6-Apr-08 11:43
Mark Salsbery6-Apr-08 11:43 
GeneralRe: drawing a cercle by code Pin
Mark Salsbery6-Apr-08 11:20
Mark Salsbery6-Apr-08 11:20 

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.