Article View: borland.public.cppbuilder.nativeapi
Article #2119Re: Extremely slow string functions
From: Thomas Maeder [TeamB]
Date: Fri, 06 Apr 2007 16:12
Date: Fri, 06 Apr 2007 16:12
16 lines
1594 bytes
1594 bytes
Bob Gonder <notbg@notmindspring.invalid> writes: > Thomas Maeder [TeamB] wrote: > >>> #include <stdlib.h> > >>> return (int)rand()*(int)rand()+(int)rand(); >> >>More importantly, the expression may overflow, in which case your >>program has undefined behavior. > > Ummm, I think the maximum calculated value is 3FFF 8000, which is > positive, and doesn't overflow unless int is 16bit. RAND_MAX is an implementation-defined value. The Standard doesn't guarantee that the quoted expression doesn't overflow.
Technical Details
Message-ID:
<m2odm1lbwm.fsf@glue.ch>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<46161b72@newsgroups.borland.com> <m2wt0pli2a.fsf@glue.ch> <eimc13peu65012pvnnsrvlhr2p22c3qm0e@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,cb6147be69a44149
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Extremely slow string functions
References: <46161b72@newsgroups.borland.com> <m2wt0pli2a.fsf@glue.ch>
<eimc13peu65012pvnnsrvlhr2p22c3qm0e@4ax.com>
From: maeder@glue.ch (Thomas Maeder [TeamB])
Organization: TeamB
X-Face: ":yn4zt^A_dn>6~{YJmu^B\'4w)e:apPM\VC=Dvf&*tASxX9|BYczkFd$xr.$vNSZ[3Uobr p]c4\+\l){!WQI.$]veP({HLd;CDYH?iN
Date: Fri, 06 Apr 2007 18:12:41 +0200
Message-ID: <m2odm1lbwm.fsf@glue.ch>
User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)
Cancel-Lock: sha1:HApxKmH1M3ZVQ1AGuA4cZFYzX50=
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
NNTP-Posting-Host: 84.73.227.225
X-Trace: newsgroups.borland.com 1175875982 84.73.227.225 (6 Apr 2007 09:13:02 -0800)
Lines: 16
X-Authenticated-User: tmaeder
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail