Mail Archives: djgpp/2000/05/21/23:26:54
Damian Yerrick wrote:
>
> On Fri, 19 May 2000 11:03:32 +0400, "Alexei A. Frounze"
> <alex DOT fru AT mtu-net DOT ru> wrote:
>
> >"A. Sinan Unur" wrote:
> >> the problem with casting an object of type size_t to int is the same as the
> >> problem with casting an unsigned int to char. sure enough there may be
> >> platforms where you don't loose any information in the process, but it is
> >> not safe. what if size_t is 64 bits and int is 32 bits? casting how can
> >> casting size_t to int be safe (even disregarding the sign issue, which is
> >> bad enough).
> >
> >Suppose we have a string. If the string is definetely shorter than INT_MAX
> >and SSIZE_MAX (say less than 32000 characters), there must be everything
> >okay with type casting for strlen(), strncpy(), etc.
>
> But if your string contains the full text of Carlo Collodi's _The
> Adventures of Pinocchio_ (loaded from the Project Gutenberg etext),
> and you're on a 16-bit system, things start to break down. Can you
> say "buffer overflow"?
In such a situation I would read it character by character and refer to
feof(). ;))
bye.
Alexei A. Frounze
-----------------------------------------
Homepage: http://alexfru.chat.ru
Mirror: http://members.xoom.com/alexfru
- Raw text -