calloc ....为什么? [英] calloc.... Why?
问题描述
有什么我想念的吗?不仅仅是:
inline void * calloc(const size_t& num,const size_t& size)
{
返回malloc( num * size);
}
-JKop
Is there something I''m missing? Isn''t it just:
inline void* calloc ( const size_t& num, const size_t& size )
{
return malloc(num * size);
}
-JKop
推荐答案
Le dimanche 18 juillet 2004 à15:15:58,JKop一个écritdans
comp.lang.c ++ *:
Le dimanche 18 juillet 2004 à 15:15:58, JKop a écrit dans
comp.lang.c++*:
有什么我想念的吗?不仅仅是:
内联void * calloc(const size_t& num,const size_t& size)
{
返回malloc(num * size);
}
Is there something I''m missing? Isn''t it just:
inline void* calloc ( const size_t& num, const size_t& size )
{
return malloc(num * size);
}
你错过了memset(...,0,num * size);部分。
-
___________ 2004-07-18 15:32:04
_ / _ \_` _`_`_)Serge PACCALIN - sp ad mailclub.net
\ \ _L_)Il faut donc que les hommes startsnt
- ''(__) parn''êtrepasfanatiquespourmériter
_ / ___(_)latolérance。 - 伏尔泰,1763
You missed the memset(...,0,num * size); part.
--
___________ 2004-07-18 15:32:04
_/ _ \_`_`_`_) Serge PACCALIN -- sp ad mailclub.net
\ \_L_) Il faut donc que les hommes commencent
-''(__) par n''être pas fanatiques pour mériter
_/___(_) la tolérance. -- Voltaire, 1763
对不起,只有一个测试
-
D ?? ?×EA 3 OD 3 O 10£π 3π 3£ó?? UA ?? U2?μ¥?DOT2 I&E'£?OEμ? ???Y?ü2?1?ó?£?
$ b $bê?2?ê?? * 3£?úD???×éà?'ò?aò???吗?×○£?è'·¢12 O ????ò??£? óú?o?£??§Dáíò?àμ?è¥μ??÷2?
$ b $bμ¥,?ú???'?à±à??? D?°?òGB2312£ ? ????????????????????????????????? OEPartnerà'?¨?? ??????????????????????????????????????????????????????????
??μ? http://rokia.vicp.net ????ê1ó??£:)
" JKop" < NU ** @ NULL.NULL> D'è????¢D ???:iK ***************** @ news.indigo.ie ...
sorry, only a test
--
D???×éà?óD?ò??£??3??3£ó??üá??ú2?μ¥?Dòt2?ì?é?£?OEμ? ?ì?Y?ü2?1?ó?£?
ê?2?ê??*3£?úD???×éà?′ò?aò???ì?×ó£?è′·¢??ò????ò??£? óúê?o?£??§Dáíò?àμ?è¥μ??÷2?
μ¥,?ú???′?à±à???D?°?òGB2312£? ???úo?á??£oùoù?£ ó??a?? OEPartner à′?¨??ò????ì
?Y?ü?£?á?éò?μ?£?è?2????¨£?
??μ? http://rokia.vicp.net ????ê1ó??£:)
"JKop" <NU**@NULL.NULL> D′è????¢D???:iK*****************@news.indigo.ie...
有吗我错过了什么?不仅仅是:
inline void * calloc(const size_t& num,const size_t& size)
{
返回malloc(num * size);
}
-JKop
Is there something I''m missing? Isn''t it just:
inline void* calloc ( const size_t& num, const size_t& size )
{
return malloc(num * size);
}
-JKop
JKop< NU ** @ NULL.NULL>写道:
JKop <NU**@NULL.NULL> wrote:
有什么我想念的吗?
一如既往,是的。请在发布前阅读常见问题解答。 (部分
comp1lang.c常见问题解答7.31)。即使只看一眼标准
或你的编译器文档也会解释
''calloc''的作用。
不是吗只是:
内联void * calloc(const size_t& num,const size_t& size)
不,它是:
void * calloc(size_t nmemb,size_t size)
{
返回malloc(num * size);
}
Is there something I''m missing?
As always, yes. Please read the FAQ before posting. (section
7.31 of the comp.lang.c FAQ). Even a glance at the Standard
or your compiler documentation would have explained what
''calloc'' does.
Isn''t it just:
inline void* calloc ( const size_t& num, const size_t& size )
No, it is:
void *calloc(size_t nmemb, size_t size)
{
return malloc(num * size);
}
描述
[#2] calloc函数为一个
nmemb对象数组分配空间,每个对象的大小都是大小。空间是
初始化为所有位零。
[#3] calloc函数返回空指针或
指向分配空间的指针。
Description
[#2] The calloc function allocates space for an array of
nmemb objects, each of whose size is size. The space is
initialized to all bits zero.
[#3] The calloc function returns either a null pointer or a
pointer to the allocated space.
这篇关于calloc ....为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!