由买买提看人间百态

topics

全部话题 - 话题: undefined
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
p*b
发帖数: 442
1
来自主题: Programming版 - Matlab/Mex中用多线程
compile/link error, something like this:
undefined reference to '_beginthreadex'
undefined reference to '_endthreadex'
怎么样才能让lcc找到多线程库?
X****r
发帖数: 3557
2
For (1), strictly speaking, the behavior of the code is undefined,
although in practice leaking memory is most likely outcome.
See 5.3.5 [expr.delete]
3 In the first alternative (delete object), if the static type of the
operand is different from its dynamic type, the static type shall be a
base class of the operand's dynamic type and the static type shall
have a virtual destructor or the behavior is undefined.
z****e
发帖数: 2024
3
来自主题: Programming版 - 问个 ctor/copy ctor的问题
first of all, you need to do:
const A &a=A();
it is temporary.
second, you need to do:
A*p=new A;
create the object on the heap if you don't want to point to a destroyed
temporary stack object.
if you call
p->somefunction();
with a destroyed stack object, i guess that's most likely an undefined
behaviour.
need some big cows to confirm the last argument about the undefined
behaviour.
t****t
发帖数: 6806
4
来自主题: Programming版 - a[i]=i++
it's either compile error or undefined. can not be both. in this case it's
undefined.
which new standard said it is right?
t****t
发帖数: 6806
5
来自主题: Programming版 - What is wrong?
it is deleted twice, since the memory allocated in function() did not get re
turned.
so it is undefined behaviour. quite often it will lead to program crash. but
quite as often it will not lead to crash. thus it is undefined.
S*********g
发帖数: 5298
6
来自主题: Programming版 - question regarding effective c++ by Meyers
undefined behavior =/= random behavior
undefined means any behavior is possible. Different enviroments and/or
different compiler could lead to different behavior.
S*********g
发帖数: 5298
7
来自主题: Programming版 - question regarding effective c++ by Meyers
你需要把这个undefined behavior做个置底了。
这样每次看到有人问undefined behavior的,
直接给指引到置底就行了
c**********e
发帖数: 2007
8
来自主题: Programming版 - C++ Q09: delete dynamic array
thrust is right.
b) It invokes undefined behavior.
This is correct. When deleting an array, the dynamic and the static type of
the object must be the same, or the behavior is undefined (C++ Standard 5.3
.5/3).
t****t
发帖数: 6806
9
来自主题: Programming版 - C++ Q20: construction and inheritance
i thought it was B::invoke, but after i checked with standard, it is
actually undefined -- a->invoke() is called in Invoker::Invoker, but A is
not a base type of Invoker then it is undefined. the standard explicitly
said so, thus there is no question about it.
see 12.7, clause 3.
楼主的这系列问题, 质量不是很高. 请阅读者注意了.
e****d
发帖数: 895
10
来自主题: Programming版 - C++ template Questions (转载)
Oh, actually, it's true the undefined order causes undefined values
are passed in.
t****t
发帖数: 6806
11
来自主题: Programming版 - C++ template Questions (转载)
no no, there is no such concept as "undefined values" in c++. there is
undefined behaviour, and there is indetermined value.
X****r
发帖数: 3557
12
来自主题: Programming版 - conversion between const to nonconst
Just don't do it.
7.1.​5.1
4. Except that any class member declared mutable can be modified,
any attempt to modify a const object during its lifetime results
in undefined behavior.
If you're still curious, under the hood compiler just assumed
the cost variable doesn't get changed at all and directly use
value 0 instead of reading from it. You can add keyword
'volatile' to force the read, e.g.
const volatile int x = 0;
const int *py = const_cast (&x);
(rest of code unch... 阅读全帖
t****t
发帖数: 6806
13
来自主题: Programming版 - c++ class definition
--quote-- [3.2, clause 5]
If the definitions of D do not satisfy these requirements, then the behavior
is undefined.
--end quote--
it's "undefined", not "ill-formed". there are multiple level of "error" in c
++ standard, you need to differentiate. conforming compiler only need to
report "ill-formed" program, without "no diagnostic required".
t****t
发帖数: 6806
14
来自主题: Programming版 - c++ class definition
well, if it's undefined instead of ill-formed, it's undefined for a reason -
- some of them are difficult to diagnose.
with the constant improvement of compiler, compiler may choose to report
some of the suspicious codes though.

last sentence, 罪过...
l*********s
发帖数: 5409
15
来自主题: Programming版 - 这个结果是啥,为什么呢?
I mean, how did you find out A1 is replaced by t1, if t1, t2, NULL are
undefined? Say, if T1 is defined as "hello", you can print out A1 and draw
the conclusion. But since all are undefined, you must be able to check the
symbol substitution by compilers directly, right?
y*********e
发帖数: 518
16
来自主题: Programming版 - operator执行顺序
C++规范里面没有定义二元运算符的执行顺序。(a) + (b) 可以是先执行a,然后执行b
,然后再执行+;也可以反之,先执行b,然后再执行a,最后执行+。
所以你这个指令 b = a++ + ++a是undefined,不同的编译器可以有不同的理解或者优
化。
尽量避免这些undefined behavior。
再如,要避免int b = foo(++a, a)类似的语句,因为C++规范里面没有定义传递到foo
的参数是从左到右,还是从右到左。
t****t
发帖数: 6806
17
来自主题: Programming版 - C signal SIGFPE 问题
man signal
According to POSIX, the behaviour of a process is undefined after it
ignores a SIGFPE, SIGILL, or SIGSEGV signal that was not generated by
the kill(2) or the raise(3) functions. Integer division by zero has
undefined result. On some architectures it will generate a SIGFPE signal.
(Also dividing the most negative integer by -1 may generate SIGFPE.)
Ignoring this signal might lead to an endless loop.
t****t
发帖数: 6806
18
there is NO "execution order" defined here. for C/C++ operators, you may say
precedence and associativity, which defines the binding order of operators:
A op1 B op2 C
is parsed as
(A op1 B) op2 C
or
A op1 (B op2 C)
if op1 has high precedence, then 1st form is taken; op2 has higher precedenc
e, 2nd form is taken. if op1 and op2 has same precedence, associativity kick
s in: if they have left assoc., 1st form is taken, otherwise 2nd form is ta
ken.
however, "execution order" is subtle. in 1st form... 阅读全帖
t****t
发帖数: 6806
19
来自主题: Programming版 - c++ pointer conversion question
you didn't read my previous post, did you?
and you didn't read the code carefully, either. intuitively, -O0 result is "correct", -O2 result is "wrong".
But the code is undefined anyway, so both result are correct. any result can be expect for undefined code.
v******l
发帖数: 512
20
来自主题: Programming版 - c++ pointer conversion question
First, I suppose your last statement should be:
printf("%d\n", a[0]);
OR
printf("%d\n", *a);
because otherwise you're printing a pointer as an integer, which does not
make much sense here.
With that change, I doubt this sample will ever print 200 at all because you
clearly give the compiler that logic you want (unlike that last sample you
deliberately hide the fact from the compiler that the two pointers are to
the same address). I'm pretty sure it will print 1065353216 on any 32/64-bit
small-en... 阅读全帖
t****t
发帖数: 6806
21
来自主题: Programming版 - c++ pointer conversion question
yes, that *a is a typo. and removing the twist, yes, compiler most probably
will give the result you expect. (but the program remains undefined.)
but no, your understanding is wrong. the target of an arbitrary cast pointer
is not undefined. but you can not alias it. the rule of thumb here is, do
not cast lvalue [and access it], but you can cast rvalue. casting a pointer
to another type is ok, but accessing through that pointer is usually not (
unless it is compatible).

you
you
bit
t****t
发帖数: 6806
22
来自主题: Programming版 - c++ pointer conversion question
What you describe is exactly undefined by standard, as I showed in my
example. it is as undefined as "a[i]=i++", or "j=(i++)*(i++)". read standard
3.10, and gcc manual "-fstrict-aliasing".
you may use union to achieve the desired result with defined behaviour.

a
behaves
g***l
发帖数: 2753
23
来自主题: Programming版 - 请教一个C++中function pointer的问题。
this is the complete error message. I think it is still related to function
template.
template
void register_dec_handle(int tag_id);
was declared in sample.hpp and was implemented in sample.cpp.
both class dec_1 and class dec_2 were declared in sample.hpp and implemented
in sample.cpp.
In main.cpp, #include "sample.hpp", refer to above code.
////////////////////////////////////
$g++ main.cpp sample.cpp sample.hpp -o sample
/tmp/ccPFwZuH.o: In function `main':
main.cpp:(.text+0x3f): und... 阅读全帖
t****t
发帖数: 6806
24
来自主题: Programming版 - 一个诡异的const_cast问题
it's undefined to modify a const value, no matter what method you use.
in other words, if a value is declared as const, you can NOT change it. if
you change it, it's undefined (means: wierd things happen).
t****t
发帖数: 6806
25
来自主题: Programming版 - 问题: C++ static_cast between int and float
casting itself is defined. but using casted pointer to access a different
type of value is undefined, unless certain conditions are met. specifically,
using floating pointer to access integer value, or vice versa, are both
undefined.

defined
f*******n
发帖数: 12623
26
来自主题: Programming版 - C++问题: 指针变量是哪里产生的?
Technically according to the standard, it's undefined behavior. Undefined
behavior means it can do anything, crash or not, or blow up your computer.
Whatever.
In practice, non-virtual function calls are looked up at compile time in all
compilers. The pointer is not used in determining which function to call.
f*****w
发帖数: 2602
27
入门问题,肯定是我什么地方理解错了 但是不明白为啥
这样的两行代码
console.log('req.body:' + JSON.stringify(req.body))
console.log('email:' + req.body['email'])
输出是:
req.body:{"body":{"email":"[email protected]
/* */"}}
email:undefined
我不明白为什么 ,明明我在body的内容里面是有email这个属性的。而且我尝试了其他
的reference的方法,都是说undefined
请问这是为啥啊?
d****i
发帖数: 4809
28
来自主题: Programming版 - 被苹果给惊呆了!! (转载)
这个不能怪Apple,C++的标准对于vector的operator[],如果越界的话,就是
undefined behavior。看一下C++的manpage:
http://www.cplusplus.com/reference/vector/vector/operator%5B%5D
Portable programs should never call this function with an argument n that is
out of range, since this causes undefined behavior.
在Linux下就会seg fault, 而在OS X下,苹果就仁慈的给了个垃圾数值的结果,只能说
苹果的implementation太委婉了一点。
t*********r
发帖数: 2431
29
来自主题: Programming版 - 被苹果给惊呆了!! (转载)
什么神经病逻辑,undefined就是undefined,怎么implement都可以。g++照你说的这么
牛逼有本事把它改成defined
d****i
发帖数: 4809
30
来自主题: Programming版 - 被苹果给惊呆了!! (转载)
这个不能怪Apple,C++的标准对于vector的operator[],如果越界的话,就是
undefined behavior。看一下C++的manpage:
http://www.cplusplus.com/reference/vector/vector/operator%5B%5D
Portable programs should never call this function with an argument n that is
out of range, since this causes undefined behavior.
在Linux下就会seg fault, 而在OS X下,苹果就仁慈的给了个垃圾数值的结果,只能说
苹果的implementation太委婉了一点。
t*********r
发帖数: 2431
31
来自主题: Programming版 - 被苹果给惊呆了!! (转载)
什么神经病逻辑,undefined就是undefined,怎么implement都可以。g++照你说的这么
牛逼有本事把它改成defined
z******g
发帖数: 17
32
I am using capybara 2.5.0, selenium driver, dropzonejs-rails 0.5.3
tried the solution from stackoverflow: http://stackoverflow.com/questions/32880524/how-do-you-test-uploading-a-file-with-capybara-and-dropzone
but I got either $('.dropzone')[0].dropzone is undefined or $('.dropzone')[0
].dropzone.listeners[0] is undefined.
Anybody has experience on this?
my html looks like this


阅读全帖
T*******n
发帖数: 493
33
来自主题: TeX版 - newcommand参数重用?
\documentclass{minimal}
\newcommand*{\mywrappercommand}[2][\undefined]{%
\ifx#1\undefined
\myactualcommand{#2}{#2}%
\else
\myactualcommand{#1}{#2}%
\fi
}
\newcommand*{\myactualcommand}[2]{%
Optional argument = #1; mandatory argument = #2.\par
}
\begin{document}
\verb|\mywrappercommand{abc}:| \mywrappercommand{abc}
\verb|\mywrappercommand[xyz]{abc}:| \mywrappercommand[xyz]{abc}
\end{document}
q**j
发帖数: 10612
34
来自主题: TeX版 - 使用bibtex一个小问题。
多谢。严格找你说的做了。但是一下是出现的问题:
LaTex warning: Citation 'Nobody06' on page 5 undefined on input line 56.
No file Learning*Latex.bbl.
[5
]("Learning Latex.aux")
LaTex warning: There were undefined references.
)
看上去好像我的bibtex不行呀。没产生Learning Latex.bbl?
应该怎么办呢?我在TexMaker里面没有改动bibtex的设置,就是
bibtex %.aux
b**n
发帖数: 289
35
来自主题: Computation版 - Strange compiler error
I try to generate Gaussian distribution random numbers using gasdev() which
references ran1(). But the compiler I use (ifort) gives me the following
error:
/tmp/ifortWvLH4w.o: In function `randomn_.gasdev_':
random.f90:(.text+0x359): undefined reference to `ran1_'
random.f90:(.text+0x36b): undefined reference to `ran1_'
So strange.
I attached the code. It looks a little bit strange below.
PROGRAM RANDOMN
IMPLICIT NONE
INTEGER :: idu=-10
REAL :: random
print *, ran1(idu),ran1(idu)
idu=-
g*********n
发帖数: 808
36
锂电池特辑1:迈向超级电池[物理]
锂离子电池,也许是下一代能源和交通问题解决的方法
1801年,伏打把他的“电堆”装置公开给拿破仑,他不可能想到两个世纪之后,他的发
明可能成为人类生活的中心。由被盐水浸泡的锌和银电极的原始电池使得小型电化学能
源-锂电池成为了现代消费电子市场的中心。
在《瓶瓶装闪电》中,科学记者森斯-费莱彻解释了锂电池的工作原理,并且对致使锂
电池盛行的研究节奏进行了描述。每年数十亿的元件生产和数十亿的美元利润,可见移
动电子市场正在繁荣。在绿色能源中,锂电池也受到了新的挑战。费莱彻描述到发展下
一代锂电池的激烈竞争,但是可能更多的人选择现有的技术。
日益减少的石油资源以及备受关注的气候变化迫使我们使用更多的替代能源,比如太阳
能、风能,也不得不用混合动力车、油电混合车以及最终的全电动汽车来替代污染的内
燃汽车。由于我们的太阳不能按照我们的要求发光,风不能按照我们的意愿吹来,这些
可再生能源的成功应用依赖于我们高效的储电能力。电化学电池,特别是锂电池,成为
了最佳选择,因为它们把化学能转变为电能效率很高并且无有毒物质释放。
玻利维亚和南美国家巨大储量的碳酸锂盐可使汽... 阅读全帖
R*******c
发帖数: 249
37
搞了三四天了,还是没成功,实在是崩溃了。。。只能上来请大牛们帮忙看看问题出在哪?
从网上下载了一个R的package(一个zip文件),这个包是在mac上build的,在mac里运行没有
问题,我现在想在windows下用这个包,直接通过R里面的install package from local
zip file会有错误如下:
Error in gzfile(file, "r") : cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip
file
2: In gzfile(file, "r") :
cannot open compressed file 'curves2_1.0.1.tar.gz/DESCRIPTION',
probable reason 'No such file or directory'
所以决定先将zip文件解压缩成文件夹,然后在windows下把这个包buil... 阅读全帖
U*E
发帖数: 3620
38
来自主题: ChinaNews2版 - Taiwan's president re-elected
Taiwan's president re-elected
By the CNN Wire Staff
updated 10:19 AM EST, Sat January 14, 2012
Ma Ying-jeou gestures to supporters outside the campaign headquarter in
Taipei, Taiwan on January 14.
STORY HIGHLIGHTS
NEW: President will take office May 20
Obama congratulates Ma on victory
Ma advocates keeping the "1992 Consensus" with China
Tsai is suspected of pushing a pro-independence agenda
Beijing (CNN) -- Taiwan's incumbent President Ma Ying Jeou was re-elected
Saturday in an election seen as... 阅读全帖
m*****u
发帖数: 15526
39
看看阿三国富翁的排场。
http://www.forbes.com/2008/04/30/home-india-billion-forbeslife-
cx_mw_0430realestate.html
内部照片link:
http://www.forbes.com/2008/04/30/home-india-billion-forbeslife-
cx_mw_0430realestate_slide_3.html?thisSpeed=undefined
压根不信阿三的基尼系数会比中国低
p*****c
发帖数: 20445
40
来自主题: Military版 - Taiwan's president re-elected
Taiwan's president re-elected
By the CNN Wire Staff
updated 10:19 AM EST, Sat January 14, 2012
Ma Ying-jeou gestures to supporters outside the campaign headquarter in
Taipei, Taiwan on January 14.
STORY HIGHLIGHTS
NEW: President will take office May 20
Obama congratulates Ma on victory
Ma advocates keeping the "1992 Consensus" with China
Tsai is suspected of pushing a pro-independence agenda
Beijing (CNN) -- Taiwan's incumbent President Ma Ying Jeou was re-elected
Saturday in an ... 阅读全帖
p******u
发帖数: 14642
41
你先别背粪,自己看完了再嚷嚷
http://www.world-nuclear.org/info/inf63.html
Reactor technology
China has set the following points as key elements of its nuclear energy
policy:
PWRs will be the mainstream but not sole reactor type.
Nuclear fuel assemblies are fabricated and supplied indigenously.
Domestic manufacturing of plant and equipment will be maximised, with self-
reliance in design and project management.
International cooperation is nevertheless encouraged.
The technology base for future reactors remain... 阅读全帖
w*********g
发帖数: 30882
42
妖魔化中国开始成为西方的主要工作了 2012-05-01 14:30:42
【相关阅读】古风解读全球经济战争实相
http://blog.wenxuecity.com/myblog/46947/201204/23873.html
世界正进入历史性的破旧迎新之大转折
http://blog.wenxuecity.com/myblog/46947/201204/25203.html
《时轮三部曲》及其前传
http://blog.wenxuecity.com/myblog/46947/201204/18485.html
中美间的战争越来越近了(1)
http://blog.wenxuecity.com/myblog/46947/201204/22117.html
中美间的战争越来越近了(2)
http://blog.wenxuecity.com/myblog/46947/201204/22840.html
为中国北斗喝彩!(文后按语)
http://blog.wenxuecity.com/myblog/46947/201112/29512.html
http://www.pau... 阅读全帖
W**********n
发帖数: 187
43
来自主题: Military版 - Hit-and-Run Driver Sought in Nun’s Death
WATER MILL, N.Y. (AP) — The police were searching Tuesday for the driver of
a vehicle that killed a nun in a hit-and-run accident Monday night on Long
Island.
The nun, Sister Jacqueline Walsh of Syosset, N.Y., was found lying next to
Rose Hill Road here around 8:30 p.m. Monday, the Southampton police said.
She had been on a retreat with colleagues from her order, the Sisters of
Mercy.
Sister Walsh had been working at St. Edward Confessor Church in Syosset for
about 10 years, said James Murphy, a... 阅读全帖
m**c
发帖数: 7299
44
【 以下文字转载自 USANews 讨论区 】
发信人: lczlcz (lcz), 信区: USANews
标 题: 一个同性恋者站出来反对同性恋婚姻
发信站: BBS 未名空间站 (Fri Mar 22 19:45:32 2013, 美东)
一个人生了病并不代表他就失去理智了.
"Pure sophistry is pitted against reason. Reason is losing."
by Rick aka Mr. Brutally Honest
A gay guy speaks out against... gay marriage:
http://www.thepublicdiscourse.com/2013/03/9622/
In our sometimes misguided efforts to expand our freedom, selfish adults
have systematically dismantled that which is most precious to children as
they grow and devel... 阅读全帖
r**********g
发帖数: 22734
45
来自主题: Military版 - "零下700度以上"有什么问题吗
根本那个温度是undefined 。不过张将军连绝对零度的量子涨落都能检测,建议发炸药奖
b*****d
发帖数: 61690
x*****8
发帖数: 10683
47
来自主题: Military版 - I'm confused about theory of relativity
Today my student asked me: If A travels from left to right with light speed
c (relative to earth), B also travels from left to right with light speed c
(relative to earth), what should be the relative speed between A and B?
I applied the formula:
relative speed = (u-v)/(1-u*v/c^2) = (c-c)/(1-c*c/c^2) = 0/0
That is undefined!
Now I'm not very sure if I did right.
Please help me!
Thank you!
c******i
发帖数: 94
48
【 以下文字转载自 WaterWorld 讨论区 】
发信人: changchi (oxo), 信区: WaterWorld
标 题: 美国中情局在香港政治中的角色
发信站: BBS 未名空间站 (Wed Oct 1 12:04:30 2014, 美东)
From Zerohedge.com
Link:http://www.zerohedge.com/news/2014-10-01/us-secretly-egging-hong-kong-protesters
不懂英文的,用谷歌翻译吧。
Is the U.S. Secretly Egging On Hong Kong Protesters?
The mass demonstrations in Hong Kong are dramatic, indeed. And given that
Hong Kong has long enjoyed a more liberal existence under British rule,
protests against a more authoritarian Chinese govern... 阅读全帖
S*********4
发帖数: 5125
49
http://www.globalresearch.ca/us-openly-approves-hong-kong-chaos
US Openly Approves Hong Kong Chaos it Created
By Tony Cartalucci
Global Research, September 30, 2014
Land Destroyer Report
Region: Asia
Theme: Police State & Civil Rights
1510
213 9
1910
chinamap
The “Occupy Central” protests in Hong Kong continue on – destabilizing
the small southern Chinese island famous as an international hub for
corporate-financier interests, and before that, the colonial ambitions of
the British Empire. Those... 阅读全帖
o**********e
发帖数: 18403
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)