函数声明嵌套? [英] function declaration nested?

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

问题描述

我已经离开了几年的编程并且很难

从我想要使用的数学/工程库中访问一个函数。

我以为double foo(double);插入调用例程将

让我说x = foo(y);但是我从汇编中得到警告

警告:嵌套的外部声明''foo''。感谢您的任何建议

Ive been away from programming for a few years and am having difficulty
accessing a function from a math/engineering library that I want to use .
I thought that double foo(double); inserted in the calling routine would
let me say x=foo(y); But I get a warning from the compilation that says
"warning: nested extern declaration of ''foo''. Thanks for any suggestions

推荐答案

" Phil Reardon" < PC ** @ pcrt.com>写道:
"Phil Reardon" <pc**@pcrt.com> writes:
我已经远离编程几年了,我很难从我想要使用的数学/工程库中访问函数。
我以为双foo(双);插入调用例程将
让我说x = foo(y);但是我从汇编中得到警告
警告:嵌套的外部声明''foo''。感谢您的任何建议
Ive been away from programming for a few years and am having difficulty
accessing a function from a math/engineering library that I want to use .
I thought that double foo(double); inserted in the calling routine would
let me say x=foo(y); But I get a warning from the compilation that says
"warning: nested extern declaration of ''foo''. Thanks for any suggestions




请发布表示您遇到的问题的最小可编译(或编译可尝试的)代码

;直到你这样做

我们只能谈论我们的怀疑,而不是指出我们所知道的

是问题所在。 插入调用程序?


如果你的意思是你做了类似的事情:


void my_name_is_of_no_consequence(void)

{

double foo(double);


x = foo(y);

}


你得到了那个警告;好吧,一个实施是在其b / b $ b b的权利内投诉任何它想要的东西。可能是

实现认为您可能打算在文件范围内声明

foo(),我不知道。只要它编译,在这种情况下就没有b $ b确实是个问题。


HTH,

弥迦



Please post the minimum compileable (or compile-attemptable) code
that exhibits the problem you are experiencing; until you do that
we can only talk about our suspicions, not point out what we know
to be the problem. "Inserted in the calling routine?"

If you mean you did something like:

void my_name_is_of_no_consequence(void)
{
double foo(double);

x=foo(y);
}

And you got that warning; well, an implementation is within its
rights to complain about anything it wants to. It may be that the
implementation "thinks" that you might have meant to declare
foo() at file-scope, I dunno. As long as it compiles, there isn''t
really a problem in this case.

HTH,
Micah


Phil Reardon写道:
Phil Reardon writes:
我已经远离编程几年而且很难访问某个功能来自我想要使用的数学/工程图书馆。
我认为那个双foo(双);插入调用例程将
让我说x = foo(y);但是我从汇编中得到警告
警告:嵌套的外部声明''foo''。感谢您的任何建议
Ive been away from programming for a few years and am having difficulty
accessing a function from a math/engineering library that I want to use .
I thought that double foo(double); inserted in the calling routine would
let me say x=foo(y); But I get a warning from the compilation that says
"warning: nested extern declaration of ''foo''. Thanks for any suggestions




C不允许嵌套函数,la Pascal。你可能想要的是一个指向*函数的*指针。这通常出现在数学中。

和C有相应的规定。



C does not allow nesting of functions, a la Pascal. It may be that what you
want is a *pointer to* a function. That comes up commonly in mathematics.
and C has provisions for that.


[...]
[...]
C不允许嵌套函数,la Pascal。可能是你想要的
是指向*函数的*指针。这通常出现在数学中。
和C有相应的规定。
C does not allow nesting of functions, a la Pascal. It may be that what you want is a *pointer to* a function. That comes up commonly in mathematics.
and C has provisions for that.



http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html

看嵌套函数


i无法确定此功能是指gcc-extensions还是

到C99扩展名。


你能说肯定它不是在C99吗?


thx


-

Daniel




http://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html

see nested functions

i couldnt figure out whether this feature refers to gcc-extensions or
to C99 extentions ..

can you say for sure it''s not in C99?

thx

--
Daniel



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

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