grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Eliminating grub_size_t


From: Pavel Roskin
Subject: Re: Eliminating grub_size_t
Date: Thu, 03 Jul 2008 15:16:35 -0400

On Thu, 2008-07-03 at 22:07 +0300, Vesa Jääskeläinen wrote:

> And size_t is kinda connected to memory addresses. Do you agree :) ?

Yes.  However, size_t should hold the maximal structure size, and we can
limit it to 4 (or even 2) gigabytes.  You can think of it as of the size
of a contiguous chunk of memory.  Difference between pointers to
different chunks doesn't have to fit size_t or ptrdiff_t.

Let's see: size_t is used:

in sizeof - OK to limit
in malloc - OK to limit
in strlen - OK to limit
in memcpy - OK to limit
in file I/O - OK to limit

We should not be limiting file and partition sizes and memory addresses,
but it's OK to limit the size of memory that is used at once, including
reading from files.  That's the whole reason why off_t may be longer
than size_t.

-- 
Regards,
Pavel Roskin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]