Structures

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,014件の閲覧回数
Timur
Contributor I
1)Why in assembler code I can't do this:
 
C Header file:
typedef struct tag_SomeBitfield
{
unsigned int bf:1;
} SomeBitfield;
 
C file:
...
SomeBitfield bfObj;
 
asm
{
 bfset bfObj.bf
}
 
I should do this:
 
asm
{
 bfset #$1,bfObj
}
 
 
2) Initialisation of structures
Why I can't initialise structure immideatly. Is will be so useful, when I have only one object.
 
struct OneObject
{
 int a=0;
 int b:1=1;
.....
}
 
struct OneObject Object1 - Default initialisation already defined!;
 
Stupid way:
 
struct Name
{
....
...
} Object=
{
...
Big Object! Screen is not latex!
...
}
 
or
 
struct a
{
int x;
int y;
...
}
#define init\
2,\
4,\
...
struct a b={init};
...
 
 
CodeWarrior 7.3, 56F8323
 
 
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
833件の閲覧回数
CrasyCat
Specialist III

Hello

I assume you are using a HC08 MCU. AM I right?

1- Inline Assembler does not support "bfset bfObj.bf"
     That is right. This notation is not supported by the inline assembler.
     You actually have to write it as "bfset #$1,bfObj".
      I will submit that as a possible improvement in the compiler.

2- Initializing a structure
The CodeWarrior compiler supports the standard ANSI C notation to initialize a structure.  ANSI C standard specifies that a structure must be initialized as follows:

struct Name
{
....
...
} Object=
{
...
...
}
 
This is not something we can change.

CrasyCat

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
834件の閲覧回数
CrasyCat
Specialist III

Hello

I assume you are using a HC08 MCU. AM I right?

1- Inline Assembler does not support "bfset bfObj.bf"
     That is right. This notation is not supported by the inline assembler.
     You actually have to write it as "bfset #$1,bfObj".
      I will submit that as a possible improvement in the compiler.

2- Initializing a structure
The CodeWarrior compiler supports the standard ANSI C notation to initialize a structure.  ANSI C standard specifies that a structure must be initialized as follows:

struct Name
{
....
...
} Object=
{
...
...
}
 
This is not something we can change.

CrasyCat

0 件の賞賛
返信