TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: andrew clarke
from: Paul Edwards
date: 1995-12-11 21:40:20
subject: fgets

> Why is fgets defined as...

> char *fgets(char *s, int n, FILE *stream);

> instead of 

> char *fgets(char *s, size_t n, FILE *stream);

ac> Interesting.  Perhaps some bright spark thought the situation where you 
ac> would want to read in a string longer than INT_MAX would never arise.

ac> That's not so bad, is it?

I'm not completely sure.  Why not just limit everything to INT_MAX?
size_t was created for a reason, and I think that reason is so
that you can declare all your character buffers to use size_t.
Since there's nothing tying size_t to int in any way, I don't know
what combinations you could end up with.  BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.