Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <20240616143143.00001d8a@yahoo.com>
Deutsch   English   Français   Italiano  
<20240616143143.00001d8a@yahoo.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feed.opticnetworks.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Michael S <already5chosen@yahoo.com>
Newsgroups: comp.lang.c
Subject: Re: Whaddaya think?
Date: Sun, 16 Jun 2024 14:31:43 +0300
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <20240616143143.00001d8a@yahoo.com>
References: <666ded36$0$958$882e4bbb@reader.netnews.com>
	<20240616015649.000051a0@yahoo.com>
	<v4lm16$3s87h$4@dont-email.me>
	<v4lmso$3sl7n$1@dont-email.me>
	<v4lr0m$3tbpj$1@dont-email.me>
	<8734pd4g3s.fsf@nosuchdomain.example.com>
	<v4ltuj$3trj2$1@dont-email.me>
	<20240616111134.00001f18@yahoo.com>
	<v4ma0a$3vrne$1@dont-email.me>
	<20240616123850.00002d93@yahoo.com>
	<v4md99$ebo$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 16 Jun 2024 13:31:26 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="803ce1cb02e96f5cc52a73edab1c8c37";
	logging-data="4157539"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18e5dzhLRk2CaSqoAUDYesQTpdnChm9MxA="
Cancel-Lock: sha1:Wl5NmWXzZ4aOzms/Rr3NBT4wlUE=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
Bytes: 2371

On Sun, 16 Jun 2024 12:03:21 +0200
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

> On 16.06.2024 11:38, Michael S wrote:

> 
> Again; which ones?
> 
> Janis
> 
> > [...]  
> 
> 

The main misconceptions are about what is returned by fgets() and by
realloc().
fgets() returns its first argument in all cases except EOF or FS read
error. That includes the case when the buffer is too short to
accommodate full input line.

With realloc() there are two issues:
1. It can sometimes return its first argument, but does not have to. In
scenario like yours it will return a different pointer quite soon.
2. When realloc() returns NULL, it does not de-allocate its first
argument.

The second case, of course, is not important in practice, because in
practice you're very unlikely to see realloc() returning NULL, and if
nevertheless it did happen, you program is unlikely to survive and give
meaningful result anyway. Still, here on c.l.c we like to pretend that
we can meaningfully handle allocation failures.