This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: strtok behaviour when uninitialized
- From: Rich Felker <dalias at libc dot org>
- To: javier--CbphpPOVok9WFxGWvC7CbkqlsxDZyT at jasp dot net
- Cc: libc-alpha at sourceware dot org
- Date: Sun, 11 Feb 2018 19:02:55 -0500
- Subject: Re: strtok behaviour when uninitialized
- Authentication-results: sourceware.org; auth=none
- References: <20180211181954.l5qkzway7zkd3345@salil> <878tbzwetl.fsf@linux-m68k.org> <20180211185345.jqcfijuchzkowkcx@salil> <1518376085.12525.187.camel@sempati.menos4>
On Sun, Feb 11, 2018 at 08:08:05PM +0100, Javier Serrano Polo wrote:
> El dg 11 de 02 de 2018 a les 13:53 -0500, Salil Kapur va escriure:
> > Why keep it undefined?
>
> Undefined behavior means efficiency. The most efficient implementation
> will either crash or not.
Efficiency is not the issue here. The issue is that a crash is the
best way to inform the programmer that their code is incorrect. This
is expressed in the glibc wiki:
https://sourceware.org/glibc/wiki/Style_and_Conventions#Bugs_in_the_user_program
Rich