奇怪的函数语法 [英] strange function syntax

查看:76
本文介绍了奇怪的函数语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做我的第一个真正的嵌入式编程项目,并且提供的

设备库有一个如下所示的函数定义:


void FCN(void )= {INTDEF,INTABS,(无符号短)PTRDEF};


其中

INTDEF =某个#defined整数

INTABS =一些绝对整数(例如2)

PTRDEF =一些#defined指针


我问的原因是我的程序挂断了(即程序<在调用这种类型的

函数时,执行冻结而没有任何异常/错误的
执行冻结,但只有在我编译了一定数量的优化时

(一切正常,没有优化)。这可能是编译器问题

我想,但我想知道上述声明的作用。


感谢您的帮助。

I am doing my first real embedded programming project and the supplied
device libraries have a function definition that looks like this:

void FCN(void) = { INTDEF, INTABS, (unsigned short) PTRDEF};

where
INTDEF = some #defined integer
INTABS = some absolute integer (e.g. 2)
PTRDEF = some #defined pointer

The reason I ask is that my program is getting hung up (i.e. program
execution freezes without any exceptions/errors) on a call to this type of
function, but only when I compile with a certain amount of optimization
(everything works fine w/o optimization). This could be a compiler problem
I imagine but I''d like to know what the above statement does.

Thanks for your help.

推荐答案

GS写道:
我正在做我的第一个真正的嵌入式编程项目和提供的
设备库有一个功能定义如下:

void FCN(void)= {INTDEF,INTABS,(unsigned short)PTRDEF};

其中
INTDEF = some #defined整数
INTABS =一些绝对整数(例如2)
PTRDEF =一些#defined指针


FCN #dede如何定义?

我问的原因是我的程序在调用这种类型的函数时被挂起(即程序执行冻结,没有任何异常/错误),但只有当我编译了一定数量的优化
(一切正常,没有优化)。这可能是一个编译器问题我想,但我想知道上面的陈述是做什么的。
I am doing my first real embedded programming project and the supplied
device libraries have a function definition that looks like this:

void FCN(void) = { INTDEF, INTABS, (unsigned short) PTRDEF};

where
INTDEF = some #defined integer
INTABS = some absolute integer (e.g. 2)
PTRDEF = some #defined pointer
How is FCN #defined?

The reason I ask is that my program is getting hung up (i.e. program
execution freezes without any exceptions/errors) on a call to this type of
function, but only when I compile with a certain amount of optimization
(everything works fine w/o optimization). This could be a compiler problem
I imagine but I''d like to know what the above statement does.




一个好的策略是剥离你的程序逐步,直到你最终得到

仍然显示此行为的最小程序。在这里发布

结果代码以获得详细帮助。


摆弄编译器/链接器时出现一些用户编程错误[dis]

选项。我知道我们程序员倾向于开始寻找

''其他人''的错误(例如,由同事,编译器或

wheather编写的库)。我(几乎)学会了首先责备自己:-)


案例



A good strategy is to strip your program stepwise until you end up with
the smallest possible program that still shows this behaviour. Post the
resulting code here to allow for detailed help.

Some user programming errors [dis]appear when fiddling compiler/linker
options. I know we programmers tend to start looking for the fault in
''others'' (e.g., libraries written by a colleague, the compiler or the
wheather). I''ve (almost) learned to first blame myself :-)

Case


FCN就是函数名称,它没有#define。
FCN is just the function name, there''s no #define of it.
void FCN(void)= {INTDEF,INTABS,(unsigned short)PTRDEF }

其中
INTDEF =一些#defined integer
INTABS =一些绝对整数(例如2)
PTRDEF =一些#defined指针
如何FCN #defined?
void FCN(void) = { INTDEF, INTABS, (unsigned short) PTRDEF};

where
INTDEF = some #defined integer
INTABS = some absolute integer (e.g. 2)
PTRDEF = some #defined pointer
How is FCN #defined?



选项。我知道我们程序员倾向于开始在其他人中查找错误(例如,由同事,编译器或其他人编写的库)。我(几乎)学会了先责怪自己: - )


options. I know we programmers tend to start looking for the fault in
''others'' (e.g., libraries written by a colleague, the compiler or the
wheather). I''ve (almost) learned to first blame myself :-)



是的,嗯,这是我个人代码审查的平行努力。


再次感谢。


Yes, well, this is a parallel effort to my personal code review.

Thanks again.


GS写道:

我正在做我的第一个真正的嵌入式编程项目和提供的<设备库有一个如下所示的函数定义:

void FCN(void)= {INTDEF,INTABS,(unsigned short)PTRDEF};

其中
INTDEF =一些#defined integer
INTABS =一些绝对整数(例如2)
PTRDEF =一些#defined指针

我问的原因是我的程序越来越多在调用这种类型的函数时挂起(即程序执行冻结,没有任何异常/错误),但只有当我编译了一定数量的优化时
(一切正常/ o优化)。这可能是一个编译器问题我想,但我想知道上面的陈述是做什么的。

I am doing my first real embedded programming project and the supplied
device libraries have a function definition that looks like this:

void FCN(void) = { INTDEF, INTABS, (unsigned short) PTRDEF};

where
INTDEF = some #defined integer
INTABS = some absolute integer (e.g. 2)
PTRDEF = some #defined pointer

The reason I ask is that my program is getting hung up (i.e. program
execution freezes without any exceptions/errors) on a call to this type of
function, but only when I compile with a certain amount of optimization
(everything works fine w/o optimization). This could be a compiler problem
I imagine but I''d like to know what the above statement does.




你将不得不揭示更多关于INTDEF和

之类的内容,并展示它们的实际定义。否则,

的人只会猜测。


-
Er ********* @ sun.com


这篇关于奇怪的函数语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆