C垃圾收集 - 疯狂的想法 [英] C garbage collection -crazy idea
问题描述
这个想法可能很疯狂。但是我希望得到这个答案..来自
comp.lang.c
如果编译器被设计成自动添加free()
匹配每个malloc()
然后它不是垃圾收集(首先,垃圾将
不生成!!) 。是否可以使用具有此类功能的编译器来获得
。或者如果它不是一个好的
想法(或者这可能是一个愚蠢的想法),请告诉我为什么会这样?
谢谢,
This idea might be vey crazy. But I hope to get answers to this .. from
comp.lang.c
If a compiler is designed such that it automatically adds a free()
matching every malloc()
then is it not a garbage collection (in the first place , garbage will
not be generated !! ) . Is it
possible to have a compiler with such feature. Or if Its not a good
idea (or may be this is an idiotic idea) please tell me why is it so ??
Thanks,
推荐答案
onkar写道:
onkar wrote:
这个想法可能很疯狂。但是我希望得到这个答案..来自
comp.lang.c
如果编译器被设计成自动添加free()
匹配每个malloc()
然后它不是垃圾收集(首先,垃圾将
不生成!!) 。是否可以使用具有此类功能的编译器来获得
。或者如果它不是一个好的想法(或者这可能是一个愚蠢的想法),请告诉我为什么会这样?
谢谢,
This idea might be vey crazy. But I hope to get answers to this .. from
comp.lang.c
If a compiler is designed such that it automatically adds a free()
matching every malloc()
then is it not a garbage collection (in the first place , garbage will
not be generated !! ) . Is it
possible to have a compiler with such feature. Or if Its not a good
idea (or may be this is an idiotic idea) please tell me why is it so ??
Thanks,
虽然有趣的想法,但我想你可以试试C ++ auto_ptrs。
我不认为自动免费会写入C标准。
Fun idea though, but I think you may try C++ auto_ptrs.
I don''t think auto-free would be wrote into C standards.
onkar写道:
onkar wrote:
这个想法可能很疯狂。但是我希望得到这个答案..来自
comp.lang.c
如果编译器被设计成自动添加free()
匹配每个malloc()
然后它不是垃圾收集(首先,垃圾将
不生成!!) 。是否可以使用具有此类功能的编译器来获得
。或者如果它不是一个好的想法(或者这可能是一个愚蠢的想法),请告诉我为什么会如此?
This idea might be vey crazy. But I hope to get answers to this .. from
comp.lang.c
If a compiler is designed such that it automatically adds a free()
matching every malloc()
then is it not a garbage collection (in the first place , garbage will
not be generated !! ) . Is it
possible to have a compiler with such feature. Or if Its not a good
idea (or may be this is an idiotic idea) please tell me why is it so ??
编译器应该如何知道/在哪里/添加免费电话?
-
Chris停止问题 Dollin
这些快捷方式都是人们使用它们。
How is the compiler supposed to know /where/ to add the `free` call?
--
Chris "halting problem" Dollin
The shortcuts are all full of people using them.
onkar说:
onkar said:
这个想法可能很疯狂。但是我希望得到这个答案..来自
comp.lang.c
如果编译器被设计成自动添加free()
匹配每个malloc()
This idea might be vey crazy. But I hope to get answers to this .. from
comp.lang.c
If a compiler is designed such that it automatically adds a free()
matching every malloc()
....然后你就不能用它来翻译任何现有的C
正确调用free()的程序。
如何调用free()?我会做出判断,谢谢
你。
-
Richard Heathfield
Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk
电子邮件:rjh在上述域名中, - www。
....then you wouldn''t be able to use it for translating any existing C
programs that correctly call free().
And how would it know when to call free()? I''ll be the judge of that, thank
you.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
这篇关于C垃圾收集 - 疯狂的想法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!