A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-October/029602.html below:

[Python-Dev] Memory size overflows

[Python-Dev] Memory size overflowsArmin Rigo arigo@tunes.org
Wed, 16 Oct 2002 10:11:18 +0200 (CEST)
Hello Guido,

On Tue, 15 Oct 2002, Guido van Rossum wrote:
> I like this one, as well as the one using 64-bit precision.  I wonder
> if we could collect a bunch of different macros and make them tunable
> for different platforms?

Doable.  I experimented with some macros that do (unsigned int)*(unsigned
int)->size_t, where the macro to use is selected according to #if's based
on the relative size of int, long and long long.

> (...) The trick will
> to ensure that the macro arguments are used exactly once in all
> versions (otherwise switching macros might unveal a new class of
> bugs).

Harder...

> Apart from *how* to check, there's a variety of cases depending on the
> types of the input and output variables.

True as well... Why are C macros so limited?...

> There are also additions, usually of small constants, which generally
> operate on the size_t.

If we are sure these are small, we can just add without any check if we
reserve a whole range of values for "overflow", e.g. ((size_t)~0x7fff) to
((size_t)~0). Not too clean however.


Armin




RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4