From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,386228a37afe967f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-20 10:13:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!freenix!enst.fr!beeblebrox!nobody From: Samuel Tardieu Newsgroups: comp.lang.ada Subject: Re: Computer Language Shootout Date: Sun, 20 Jul 2003 19:10:32 +0200 Organization: Avian Carrier & Friends Message-ID: <87r84lt987.fsf@inf.enst.fr> References: <1ec946d1.0307150715.4ba69f85@posting.google.com> <3F149243.80304@attbi.com> <3F15930C.2070907@attbi.com> <87k7aeqfcf.fsf@inf.enst.fr> <3F19E1BB.5000908@attbi.com> <87n0f9poyc.fsf@inf.enst.fr> <3F1A98F4.3090304@attbi.com> NNTP-Posting-Host: willow.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: avanie.enst.fr 1058721196 15709 137.194.161.3 (20 Jul 2003 17:13:16 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sun, 20 Jul 2003 17:13:16 +0000 (UTC) Mail-Copies-To: sam@rfc1149.net User-Agent: Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.5 (cauliflower, i386--freebsd) Cancel-Lock: sha1:0RxDeEo+0xpsQbNhRIuoGE6g+6M= X-Leafnode-NNTP-Posting-Host: 127.0.0.1 Xref: archiver1.google.com comp.lang.ada:40527 Date: 2003-07-20T19:10:32+02:00 List-Id: >>>>> "Robert" == Robert I Eachus writes: Robert> If I were writing it, I would use a (OS specific) call to find Robert> out how many characters I would read, if available, and create Robert> exactly that much space on the stack. If I couldn't determine Robert> the size, I would read into a relatively large scratchpad in Robert> the heap, and deal with overruns carefully. Such a function would be a nightmare to implement properly. Not only would it be unusable in systems which do not allow dynamic allocation (absence of heap for example), but also it would force the compiler to keep track of how the object was created (object from the stack or from the heap). Also, creating a "relatively large scratchpad" won't cover all cases, you will have to realloc memory in some cases. Also, you would waste precious heap memory in multitasking systems, maybe causing other tasks to raise Storage_Error on memory allocation attempts. Being more on the embedded side, I dislike any dynamic memory allocation which is not caused by an explicit "new". Sam -- Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/sam