Message from discussion
Strange Behaviour in finding Size of a File
Received: by 10.66.80.98 with SMTP id q2mr6018101pax.33.1352560350492;
Sat, 10 Nov 2012 07:12:30 -0800 (PST)
Path: 6ni73279pbd.1!nntp.google.com!news.glorb.com!feeder.erje.net!eu.feeder.erje.net!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!reader01.nrc01.news.zen.net.uk.POSTED!not-for-mail
From: Ben Bacarisse <ben.use...@bsb.me.uk>
Newsgroups: comp.lang.c
Subject: Re: Strange Behaviour in finding Size of a File
References: <8439d649-fae9-4828-8a86-d0c7c8489aa5@googlegroups.com>
<k7j071$msq$1@dont-email.me>
<86a789ac-8abc-45e3-b37d-719f13fe2da7@s14g2000vba.googlegroups.com>
Date: Sat, 10 Nov 2012 15:12:28 +0000
Message-ID: <0.6065308e19e393cf0401.20121110151228GMT.87zk2pmqzn.fsf@bsb.me.uk>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
Cancel-Lock: sha1:2EOaie8zUymqz4+k33ch06DInqY=
MIME-Version: 1.0
Lines: 29
Organization: Zen Internet
NNTP-Posting-Host: 85bde4ed.news.zen.co.uk
X-Trace: DXC=7CWI2?jG\@X4oFHPKRD_mRa0UP_O8AJo\=dR0\ckLKGPWeZ<[7LZNRVe@R]4>;JV[[0L4FB;9HCoPi]MG]iNCjgUm2FK==o]\HR
X-Complaints-To: abuse@zen.co.uk
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Nick Keighley <nick_keighley_nos...@hotmail.com> writes:
> On Nov 9, 1:24Â pm, Eric Sosman <esos...@comcast-dot-net.invalid>
> wrote:
>> On 11/9/2012 2:09 AM, felix wrote:
<snip>
>> > //-- Code starts here : --
>>
>> > static size_t LogSize = 1048576;
>>
>> Â Â Â Ah. This is obviously some strange usage of "10 MB" that
>> I hadn't previously been aware of.
>>
>> > It is strange that the condition got satisfied when results.st_size
>> > = 2589116.
>>
>> Â Â Â Not all *that* strange ...
>
> this is why you don't put numbers like that in your code
>
> #define K 1024
> #define M (K * K)
> #define LOG_SIZE (10 * M)
I'd put an 'L' suffix on the 1024 since 10 * M is outside the minimum
range or plain int arithmetic.
--
Ben.