const函数?? [英] const function??

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

问题描述

这个声明是什么意思?


void function_name()const

{}


这意味着功能是不变的?是什么意思?


谢谢

what does this declaration mean?

void function_name() const
{}

This means that the function is constant? what is the implication?

Thanks

推荐答案



franco ziade写道:

franco ziade wrote:
这个声明是什么意思?

void function_name()const
{}

这意味着函数是常量吗?这意味着什么?
what does this declaration mean?

void function_name() const
{}

This means that the function is constant? what is the implication?




这意味着您的代码已损坏。你有没有尝试编译它?


笔记本电脑〜#gcc -Wall -W -O2 -c test.c

test.c:在函数中function_name'':

test.c:2:错误:在''''令牌之前解析错误


我的意思是你不妨问什么


for_lots_of_items(int i = 0到3;而我< 14;添加到我)

显示我,我可以;

意味着......


Tom



It means you have broken code. Did you even try to compile it?

laptop ~ # gcc -Wall -W -O2 -c test.c
test.c: In function `function_name'':
test.c:2: error: parse error before ''{'' token

I mean you might as well ask what

for_lots_of_items (int i = 0 through 3; while i < fourteen; add to i)
display me i please;

means...

Tom


franco ziade< fz **** @ videotron.ca>写道:
franco ziade <fz****@videotron.ca> wrote:
这个声明是什么意思?
void function_name()const
{}
这意味着函数是常量吗?这意味着什么?
what does this declaration mean? void function_name() const
{} This means that the function is constant? what is the implication?




你确定这应该是C而不是C ++吗?如果它是C ++

那么你是错误的组,请在comp.lang.c ++中询问。在

C这个函数声明是一个语法错误。


问候,Jens

-

\ Jens Thoms Toerring ___ Je *********** @ physik .fu-berlin.de

\ __________________________ http:/ /www.toerring.de


franco ziade在25/02/05写道:
franco ziade wrote on 25/02/05 :
这个声明是什么意思?

void function_name()const
{}
what does this declaration mean?

void function_name() const
{}




没什么。解析错误。


-

Emmanuel

C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html

C库: http://www.dinkumware .com / refxc.html


" Mal nommer les choses c''est ajouter du malheur au

monde。 - Albert Camus。



Nothing. Parse error.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
The C-library: http://www.dinkumware.com/refxc.html

"Mal nommer les choses c''est ajouter du malheur au
monde." -- Albert Camus.


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

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