On Mon, 30 Jan 2017 13:32:46 -0700
Scott Robison <sc...@casaderobison.com> wrote:

> Basing source on "ANSI C" (as much as possible) just gives you the
> biggest possible distribution / compatibility. 

Yes, but it also limits you to C as it stood 20 years ago.  And
counting.  Is there no point at which a more recent standard should be
adopted?  Among features of C11 I use:

        stdint.h
        stdbool.h
        VLA
        designated initialization

SQLite would benefit from all of those, plus UTF-8 string constants.  

I full well understand the workarounds for integer sizes and Booleans
are baked into SQLite, and there's no real need to adopt the new (er,
new-ish) forms.  VLAs and designated initializers should not be
underestimated, though.  There are many places in SQLite where VLAs
could replace local malloc/free pairs, and SQLite code is rife with
structures that can be more succintly initialized with the modern
syntax.  

> [iBook] From a little searching online, 10.2 was the last release in
> 2002, and it seems that it may have included GCC 3.3. GCC 3.3

In 2002, that might have been the best available.  15 years later, I
suspect better compilers are available for that OS.  The state of
compilers then is not the question.  The state of compilers now is.  

> given that a fix for this issue has already been committed, and
> allows the code to work with both C89 & C99, the original report is
> no longer a consideration.

True.  I never thought the original report was problematic or
symptomatic.  

When I took my C out of its rusty scabbard, back around when that iBook
was new, I adhered to my K&R.  None of that size_t stuff for me!  The
Internet visited its instruction, though, and over time I grew to
appreciate why lseek(2) returns off_t and so on.  

Nowawdays, once again making a living writing C code and having the
daily opportunity to experiment the the new language features, I've
come to like them.  C is a sharp-edged language, and has become a bit
fussy as the compilers writers have adopted, as we've discussed here, 
pedantic notions of UB.  OTOH, it's an improvement to relieve the
language of some of its ancient constraints, such as static array sizes
and the prohibition on type-punning in unions (which began as SOP, then
was UB, and is now OK again).  

Knowing what I do of the philosophy of the SQLite developers -- if we
can speak of such -- I honestly think they (you) would find C11
amenable.  It's a better language.  It's every bit as respectful of its
environment, and is more standardized and more easily conformed to it.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to