由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - ??? i m confused
相关主题
__FUNCTION__ 是怎么回事呀?Help: undefined symbol
inline functions in C++C/C++ __int64和long long, cross platform问题
How to see the content of a library file请问关于c++实现singleton的问题?
发个初级面试题请版上的C++牛人讲一下g++的优化参数
GCC对单行的表达式的长度有限制么?问一个C++下的Bug(Linux下)
面试被问到G++和GCC编译器的关系调试版链接时间特别长
Help: Another C++ compilation error on GCC[合集] a C++ template question (code inside)
C++ help: 一个multiple definition problem.[合集] 导师叫我装C++
相关话题的讨论汇总
话题: confused话题: return话题: func话题: vc话题: gcc
进入Programming版参与讨论
1 (共1页)
c********e
发帖数: 383
1
according to BS, if a function has a return value non-void, it must return
sth in its definition.
however, the following code compile with Gcc/VC 7.1
int func (void) {}
why?
c********e
发帖数: 383
2
seems not the case for gcc 3.3

【在 c********e 的大作中提到】
: according to BS, if a function has a return value non-void, it must return
: sth in its definition.
: however, the following code compile with Gcc/VC 7.1
: int func (void) {}
: why?

g*****g
发帖数: 34805
3
Because C++ is a pain in the butt itself.
It's never a strong type language which an OOL should be.
r****y
发帖数: 26819
4
If you use the return value, such like
cout << func();
compiler will report error.
If func() is a global function, VC compiler will report error too.
For member function, ok if return value not used.

【在 c********e 的大作中提到】
: according to BS, if a function has a return value non-void, it must return
: sth in its definition.
: however, the following code compile with Gcc/VC 7.1
: int func (void) {}
: why?

1 (共1页)
进入Programming版参与讨论
相关主题
[合集] 导师叫我装C++GCC对单行的表达式的长度有限制么?
[合集] 6个变态的C语言写的Hello World (ZZ)面试被问到G++和GCC编译器的关系
C++ questionHelp: Another C++ compilation error on GCC
一般visual studio C++ 下编译通过的程序放到linux下编译需要做什么改动?C++ help: 一个multiple definition problem.
__FUNCTION__ 是怎么回事呀?Help: undefined symbol
inline functions in C++C/C++ __int64和long long, cross platform问题
How to see the content of a library file请问关于c++实现singleton的问题?
发个初级面试题请版上的C++牛人讲一下g++的优化参数
相关话题的讨论汇总
话题: confused话题: return话题: func话题: vc话题: gcc