由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - global variable problem
相关主题
抠字眼:assignment and initialize in C++c++ 不自动initialize变量么?
魏老师,你很激动,来,我们做个项目管理fork(): why both if and else are executed?
关于在C中定义常量GO似乎是目前最难反编译的代码了
static initialization dependency c++How to initialize object in constructor?
one question about initializaiton listthrust, about the initialization of POD
how to initialize associate data in STL mapquestion about structure initializationa and reference
一道 memset in C++的题 error LNK2001:的错误如何改正?
Is it possible to initialize container in initialization list?大家谈谈看??
相关话题的讨论汇总
话题: theta话题: atan话题: code话题: double话题: global
进入Programming版参与讨论
1 (共1页)
n********r
发帖数: 65
1
/*------------- code begin --------------- */
#include
const double theta = 0.5 * atan(2);
int main(void)
{
double a = 3.14159;
.....
.....
return 0;
}
/*------------- code end --------------- */
some books say the global variables are initilized
at the compile time. Is this true in the above case?
If in this case theta is initialized at the run time,
then when does the code " theta = code 0.5 * atan(2) " been executed?
before " double a = 3.14159 " or after that?
k****f
发帖数: 3794
2
atan需要用到math lib,编译的时候还没有math lib
link的时候才能看的

【在 n********r 的大作中提到】
: /*------------- code begin --------------- */
: #include
: const double theta = 0.5 * atan(2);
: int main(void)
: {
: double a = 3.14159;
: .....
: .....
: return 0;
: }

N*********y
发帖数: 105
3
before main() actually executes.

【在 n********r 的大作中提到】
: /*------------- code begin --------------- */
: #include
: const double theta = 0.5 * atan(2);
: int main(void)
: {
: double a = 3.14159;
: .....
: .....
: return 0;
: }

1 (共1页)
进入Programming版参与讨论
相关主题
大家谈谈看??one question about initializaiton list
Is the order of initialization a, b, c or c, b, a?how to initialize associate data in STL map
码工试题 (转载)一道 memset in C++的题
C++里面如何最方便的表示这个数组的数组?Is it possible to initialize container in initialization list?
抠字眼:assignment and initialize in C++c++ 不自动initialize变量么?
魏老师,你很激动,来,我们做个项目管理fork(): why both if and else are executed?
关于在C中定义常量GO似乎是目前最难反编译的代码了
static initialization dependency c++How to initialize object in constructor?
相关话题的讨论汇总
话题: theta话题: atan话题: code话题: double话题: global