News for hackers. Stuff that matters.
Re:Why Is SQLite Coded in C? (2017) by rwbt on Wednesday March 14, 2018 @11:47AM (#16585585)
My favorite aspect of programming in C is how little it gets in the way of the programmer. Once you become familiar with the language there is not much to lookup in the docs because it's such a small language. I might end up writing more verbose code, but it's usually very clear to me. You still can write spaghetti code but that's besides the point.
Re:Why Is SQLite Coded in C? (2017) by simias on Wednesday March 14, 2018 @03:04PM (#16587382)
I mostly agree but I think there are too many weird UB and corner cases to qualify as a small language. I guess C compiled with -fwrapv -fno-strict-overflow -fno-strict-aliasing and a few others might come close to what you're describing.

I think C's apparent simplicity lulls me into complacency at times, I delude myself into thinking that I'm coding into some kind of macro assembly and I think I know what the resulting machine code will look like. And then some super weird optimization or UB kicks in and nothing makes sense anymore, because I stopped playing by the rules and I triggered the footgun.

Just look at the number of bug reports on the GCC bugtracker for code that at a glance ought to work and it turns out that it's actually not a bug, the code just triggered a subtle UB and the compiler ran away with it and generated code that ate your cat.

Re:Why Is SQLite Coded in C? (2017) by geezerjay on Wednesday March 14, 2018 @04:10PM (#16587868)
> I mostly agree but I think there are too many weird UB and corner cases to qualify as a small language.

I don't see the point of your claim regarding undefined behaviour. The rules are quite simple: undefined behavior means compiler-specific behavior. Therefore, if you aim for compiler independence then you don't use it. If somehou you decide yo target a compiler then you read the compiler's docs. It's that simple.

These UB complains are even more ridiculous when we realize they complain about the fact that the language is actually defined.

Re:Why Is SQLite Coded in C? (2017) by simias on Wednesday March 14, 2018 @04:51PM (#16588186)
UB is not implementation defined, it's UB. Some compilers have options to defuse certain classes of UBs but then you're effectively coding in a non-compatible dialect of C. Otherwise you can't ever rely on a certain UB behaving one way or an other: a simple compiler update, code change or compiler flag modification could break everything. A compiler is under no obligation to define what it does in case of UB and that's the point of it, it leaves some room for aggressive optimization.

There are "implementation defined" details in the C standard but it's a different problem, see for instance: https://gcc.gnu.org/onlinedocs/gcc/C-Implementation.html

Anyway that wasn't really my point, the problem is that some of these UB can arise because of subtle bugs in code that might not look suspicious at a glance. Things like breaking aliasing rules, mis-using unions, casting things that aren't compatible etc... Your code triggers an UB and you don't know it. Actually you might not notice it until you turn an optimization flag or you update your compiler and suddenly it doesn't do what you want anymore.

Even something as trivial as computing a pointer that's more than one byte after the end of an object is UB for instance (not dereferencing it, merely computing its address). For that reason `ptr.offset` in unsafe in Rust for instance, even though it doesn't dereference the pointer.

Re:Why Is SQLite Coded in C? (2017) by Thiez on Thursday March 15, 2018 @05:29AM (#16591389)
I find it a bit silly that `ptr.offset` is unsafe, but casting an arbitrary integer to a pointer isn't. E.g.:

    fn main() {
        // Look, an invalid pointer, no `unsafe` required.
        let ptr = 1000 as *const u8;
        // boom, segfault.
        println!("{}", unsafe { *ptr });
    }
Using casting one can even implement a "safe" pointer offset function, like so:

    fn main() {
        fn safe_offset<T>(ptr: *const T, offset: isize) -> *const T {
            ((ptr as usize).wrapping_add(offset as usize)) as *const T
        }
        let xs = [0u8, 10];
        let ptr = safe_offset(&xs[0], 1);
        println!("{}", unsafe { *ptr }); // prints '10'
    }
Obviously this "safe_offset" function can easily be used to trigger UB by computing invalid pointers, and not a single line of unsafe code was required (although we do need `unsafe` to dereference the bad pointer and actually trigger segfaults).
Re:Why Is SQLite Coded in C? (2017) by steveklabnik on Thursday March 15, 2018 @06:27AM (#16591609)
I believe this is because offset uses an llvm intrinsic with the extra requirements, as it uses that info for optimization. Your version doesn't.
Re:Why Is SQLite Coded in C? (2017) by simias on Thursday March 15, 2018 @06:35AM (#16591639)
Interesting. However, isn't casting a random (potentially invalid) integer into pointer triggering the same potential UB? I ask because for GCC it is apparently:

>When casting from pointer to integer and back again, the resulting pointer must reference the same object as the original pointer, otherwise the behavior is undefined. That is, one may not use integer arithmetic to avoid the undefined behavior of pointer arithmetic as proscribed in C99 and C11 6.5.6/8.

https://gcc.gnu.org/onlinedocs/gcc/Arrays-and-pointers-imple...

That's pretty explicitly what Thiez was doing in their rust code, although obviously Rust/LLVM might have different semantics here.

Re:Why Is SQLite Coded in C? (2017) by dbaupp on Thursday March 15, 2018 @06:52AM (#16591712)
The docs list no undefined behaviour for inttoptr, so it's (probably) not problematic at the LLVM level: http://llvm.org/docs/LangRef.html#inttoptr-to-instruction .
Re:Why Is SQLite Coded in C? (2017) by steveklabnik on Thursday March 15, 2018 @06:47AM (#16591702)
The exact rules of unsafe code are still up in the air. It’s not explicitly defined as UB yet, IIRC, and when we set the rules, we have a goal of not invalidating large swaths of code.
Re:Why Is SQLite Coded in C? (2017) by zbentley on Wednesday March 14, 2018 @04:20PM (#16587955)
> if you aim for compiler independence then you don't use [undefined behavior].

I think the point was that UB occurs in a lot of relatively common cases and programmers don't realize that they're depending on it/experiencing it.

> If [somehow] you decide [to] target a compiler then you read the compiler's docs.

Which is why the post you're responding to made the point about undefined behavior. "Read the compiler's docs" is in counterpoint to that post's parent, which praises C for being a small language, and thus one in which reading the language's docs is seldom required.

Re:Why Is SQLite Coded in C? (2017) by ethelward on Wednesday March 14, 2018 @11:51AM (#16585629)
I'm not sure I get your point. You say that C is a tiny language, hence leading to small docs, but that can be said of every language? Except that they may have larger standard libraries, but nothing stop you from using a subset of them.
Re:Why Is SQLite Coded in C? (2017) by colanderman on Wednesday March 14, 2018 @11:58AM (#16585681)
Python is a tremendously complicated language, even disregarding the standard library. Understanding all the "everything-is-an-object" magic that goes on behind the scenes is a burden which C does not share.

(Though, C does have its share of mental burdens. Understanding automatic type conversion is quite a beast.)

Re:Why Is SQLite Coded in C? (2017) by ethelward on Wednesday March 14, 2018 @12:01PM (#16585702)
Though I wouldn't compare python and C, as they obviously don't target the same domain, for C, you have a whole world of UB and system interaction that you also have to keep in mind which is, IMHO, worse than the thing going on in Python.
Re:Why Is SQLite Coded in C? (2017) by forgot-my-pw on Wednesday March 14, 2018 @12:20PM (#16585854)
The language specs is 700-page long, I wouldn't call that tiny: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf

Sure, C++ is double of that, but it's still long. In comparison, Java language specs is around 800 pages, Ruby 330 pages, and C# 500 pages.

Re:Why Is SQLite Coded in C? (2017) by naasking on Wednesday March 14, 2018 @12:43PM (#16586048)
> The language specs is 700-page long, I wouldn't call that tiny

To be fair, that now includes a substantial standard library. The language + preprocessor spec ends on page 197 and starts on page 19, for a total of 178 pages.

Re:Why Is SQLite Coded in C? (2017) by nwmcsween on Wednesday March 14, 2018 @01:08PM (#16586321)
Language spec length is meaningless unless it's in some sort of quantifiable format.
Re:Why Is SQLite Coded in C? (2017) by the_why_of_y on Thursday March 15, 2018 @02:31PM (#16595365)
None of the specifications you cite contains a formal semantics of the language in question; that ought to be the basis on which arguments about simplicity should be founded.

(Why the lack of formal semantics? My guess is that all of these languages, to varying degree, are too complex to easily formalize...)

Re:Why Is SQLite Coded in C? (2017) by AnIdiotOnTheNet on Wednesday March 14, 2018 @01:06PM (#16586300)
Means nothing if you aren't talking about what that documentation actually includes. I currently work in a language that has like 10 pages of documentation, much of which is "TODO".
Re:Why Is SQLite Coded in C? (2017) by Skunkleton on Wednesday March 14, 2018 @12:32PM (#16585942)
The length of the spec isn't really relevant is it? Or are you implying that C is about as complex as Java?
Re:Why Is SQLite Coded in C? (2017) by pcwalton on Wednesday March 14, 2018 @12:41PM (#16586023)
C is significantly more complex than Java. The memory model of Java is simple (multithreading notwithstanding), because it's memory-safe and garbage collected. Not so for C, which has very subtle rules, which result in undefined behavior if broken.
Re:Why Is SQLite Coded in C? (2017) by akvadrako on Thursday March 15, 2018 @08:04AM (#16592050)
The rules for java memory management could probably fill 200 pages just by itself and it's not easy to debug issues with leaks, excessive overhead and the several layers and variants of garbage collectors.

C's memory model is trivial by comparison.

Re:Why Is SQLite Coded in C? (2017) by boomlinde on Wednesday March 14, 2018 @01:14PM (#16586390)
The question here isn't whether it's easier to write correct C programs than Java programs, it's whether C is a simple language.

Subtle UB, as much of a headache as it can be to a programmer using the language, in this case leads to simpler implementation of a compiler.

Re:Why Is SQLite Coded in C? (2017) by pcwalton on Wednesday March 14, 2018 @02:13PM (#16586964)
No, it doesn't. Maybe it did in 1978, but modern C compilers have to go to heroic lengths to do things like alias analysis that would be easier if the aliasing rules of C weren't so subtle. In Java the question of "can pointer A alias pointer B" is simple (unless typeof A derives typeof B or vice versa, the answer is no). In C, due to TBAA, it's hideously complex.
Re:Why Is SQLite Coded in C? (2017) by jcranmer on Wednesday March 14, 2018 @04:38PM (#16588080)
If you look at software engineering and static analysis papers for a language like Java, there's often a discussion about using stuff like 2-object, 3-call site context sensitive alias analyses built on more or less fairly standardized Datalog rules. If you look at C or C++, the response is generally "you want a precise alias analysis? fall down in riotous laughter".

The rules for TBAA are complex, and many C/C++ programs violate those rules because it's so hard to actually make sure you're not violating them, and half of the purpose of using C/C++ is actually to be able to do the kind of type-punning that TBAA prohibits.

Re:Why Is SQLite Coded in C? (2017) by boomlinde on Wednesday March 14, 2018 @07:01PM (#16589132)
I mean writing a compiler that fulfills the specification. Whether a design complicates the implementation of alias analysis doesn't really change whether it is simple.
Re:Why Is SQLite Coded in C? (2017) by kevinmgranger on Wednesday March 14, 2018 @01:48PM (#16586743)
I think you've pointed out the distinction many miss when talking about simplicity, which results in talking past each other:

simplicity for the user and simplicity for the compiler writer are totally different things. Java is simpler for the user but more complex for the implementer, and C is more complex for the user but simpler for the implementer.

Re:Why Is SQLite Coded in C? (2017) by Ace17 on Wednesday March 14, 2018 @01:59PM (#16586838)
> nothing stops you from using a subset of [the standard libraries].

This only applies if you're writing 100% of the code. Not having coworkers to mess around with every corner-case of the langage is a rare privilege.

Re:Why Is SQLite Coded in C? (2017) by pjc50 on Wednesday March 14, 2018 @11:58AM (#16585685)
C++ is a huge language by comparison, and very few people know every corner of it.
Re:Why Is SQLite Coded in C? (2017) by Ace17 on Wednesday March 14, 2018 @02:04PM (#16586883)
Very few people know every corner of the English language, or, say, French. This doesn't prevent us from communicating, though.
Re:Why Is SQLite Coded in C? (2017) by LaGrange on Wednesday March 14, 2018 @12:01PM (#16585706)
In Python, you _need_ to understand the GC and its class system - even if you ignore it, the standard library doesn't. In C++ the situation is similar unless you're actually writing C and compiling it with a C++ compiler. Go is fairly small for a modern language, but it does have a GC and a fancy type system.

OTOH preprocessor directives grow the base C a bit. It's still very tiny, though.

Re:Why Is SQLite Coded in C? (2017) by kevinmgranger on Wednesday March 14, 2018 @01:50PM (#16586754)
In what way do you need to understand the GC before using it? The only thing I can think of is avoiding circular references.
Re:Why Is SQLite Coded in C? (2017) by Retric on Wednesday March 14, 2018 @02:31PM (#16587130)
GC can cause a lot of issues if you care about how exactly long something takes.

Like all abstractions there are corner cases that force you to deal with the underlying complexity.

Re:Why Is SQLite Coded in C? (2017) by LaGrange on Thursday March 15, 2018 @08:19AM (#16592161)
Go ahead and allocate and deallocate lots of tiny objects in a short period of time. Depending on GC, you'll either run out of memory, or grind down to a halt.
Re:Why Is SQLite Coded in C? (2017) by dopamean on Wednesday March 14, 2018 @03:53PM (#16587733)
I don't write C but I have to imagine that the language being small doesn't really save you from having to look up stuff in documentation. If the language doesn't have it surely some library will and you'll have to read the docs no? The "problem" has just been outsourced.
Re:Why Is SQLite Coded in C? (2017) by murukesh_s on Wednesday March 14, 2018 @12:27PM (#16585900)
"but that can be said of every language? "

What about Haskell?

Re:Why Is SQLite Coded in C? (2017) by tome on Wednesday March 14, 2018 @02:19PM (#16587028)
I'm not sure what you mean. Haskell is a small language.
Re:Why Is SQLite Coded in C? (2017) by chewxy on Thursday March 15, 2018 @02:23AM (#16590798)
GHC Core is. Haskell is far from small

https://blog.chewxy.com/2014/09/03/small-languages/

Re:Why Is SQLite Coded in C? (2017) by pentagonpapers on Wednesday March 14, 2018 @11:54AM (#16585647)
If you think C++ is not overly complicated, just what is a protected abstract virtual base pure virtual private destructor and when was the last time you needed one?
Re:Why Is SQLite Coded in C? (2017) by maxlybbert on Thursday March 15, 2018 @05:25AM (#16591371)
I know the original quote was meant as a complaint about C++, but it’s always seemed to me to be more about how people were teaching C++ in the ‘90s.

What about the zinger, “if you think English is not overly complex, just what is a loud old fast tall red car, and when was the last time you needed one?” No language I’m familiar with limits the number of adjectives you can use for a single noun. That doesn’t mean you generally should string several adjectives together; usually you’re fine just saying “car,” but sometimes you need the ability to be specific. English is a complicated language, but limiting how many adjectives can apply to a particular noun would make it much worse in my opinion.

As for the original question, a pure virtual function is a function that must be implemented in a derived class, while a private function is a function that can’t be accessed outside of the class, not even from derived classes. A destructor is a function used to clean up when an object goes out of scope; I don’t think anything about the destructor is important in this case, it just happens to be a convenient member function to use.

The combination would make it impossible to instantiate objects of the class (because of the pure virtual function) or objects of classes that inherit from it (because the pure virtual function can’t be accessed, let alone implemented, from a derived class). That rules out much of what you’d want to do with a class. You’re left with static data and functions, and nested types. Overall, the best I can tell, you would use that to make the class imitate a namespace. But for the last twenty years, you don’t have to imitate namespaces: C++ has them.

You might still find somebody trying to avoid using actual namespaces because of a vague fear of argument dependent lookup, but to be honest, I’ve never seen argument dependent lookup call the wrong function. Some programmers oppose it in principle, but in practice it doesn’t seem to cause much trouble.

Re:Why Is SQLite Coded in C? (2017) by jcelerier on Wednesday March 14, 2018 @12:16PM (#16585819)
If you think C is not overly complicated, just what is a static const __declspec((dllimport)) __restrict volatile unsigned long long int* and when was the last time you needed one?
Re:Why Is SQLite Coded in C? (2017) by dreta on Wednesday March 14, 2018 @12:29PM (#16585917)
Considering that half of that is not standard C code, and the other is just a standard way of declaring a pointer that doesn’t differ much in any other typed language, i don’t think you’re making a point here.
Re:Why Is SQLite Coded in C? (2017) by DSMan195276 on Wednesday March 14, 2018 @03:01PM (#16587350)
I would agree, if you take out the __declspec((dllimport) then it's just a 'static const restrict volatile long long int * ', which has lots of qualifications but isn't really much more then just a pointer to a `long long`. The qualifiers make it a bit harder to reason about, but that's also why people rarely use `restrict` and `volatile` in the first place.

I could be wrong but I think the above poster hasn't actually written tons of C, or else they would have picked a much more complicated example. If you throw a bunch of arrays, pointers, and function pointers in it quickly gets out of hand, like this:

    int (* const(*foo)(int (*)(int, int))[5])(void);
That thing defines 'foo', which is a pointer to a function who's first argument is a pointer to a function return a int and taking two ints as arguments, and returns a pointer to an array of 5 const function pointers which take no arguments and return an int.

Thankfully, you rarely run into something like that in the wild. And if you `typedef` the function pointers (Which is a pretty common now) it becomes tons easier to read.

Re:Why Is SQLite Coded in C? (2017) by jcelerier on Wednesday March 14, 2018 @03:16PM (#16587481)
> That thing defines 'foo', which is a pointer to a function who's first argument is a pointer to a function return a int and taking two ints as arguments, and returns a pointer to an array of 5 const function pointers which take no arguments and return an int.

I find this much easier to understand than something with different keywords and qualifiers. Function pointers follow some simple rules to read, but can you be sure of what `volatile` implies ?

Re:Why Is SQLite Coded in C? (2017) by DSMan195276 on Wednesday March 14, 2018 @04:10PM (#16587865)
> I find this much easier to understand than something with different keywords and qualifiers. Function pointers follow some simple rules to read, but can you be sure of what `volatile` implies ?

Hmm, I suppose we just disagree then, which is fine. Things like `restrict` and `volatile` don't really bother me because:

1. The spots where people actually need to use them are very rare (`restrict` does have uses, but almost nobody uses it commonly. `volatile` has pretty much no correct uses outside of accessing registers in low-level code).

2. It's still just a pointer to a long long. I would need to look-up what __declspec((dllimport)) does, and I'd be highly suspicious of the use of `restrict` and `volatile` if it was not explained, but I still generally know what it is and how it can be used. Whereas with the example I gave, without staring for a long time or throwing it into a parser I can hardly tell what the type even is, let alone wrap my head around how it will be used.

Re:Why Is SQLite Coded in C? (2017) by dreta on Wednesday March 14, 2018 @04:44PM (#16588123)
>`volatile` has pretty much no correct uses outside of accessing registers in low-level code

Sorry, but what are you guys on about? You use "volatile" if you don't want the compiler to produce code that caches a variable. You use it all the time in embedded systems, or when writing multi-threaded code, etc. The usage of "volatile" is very clear, and should be well understood. "restrict" isn't used much because it's a c99 standard first of all, and second of all, it's like "inline"; it might make a difference, might not, and not a lot of people are in a situation where they have to shave off cycles.

Re:Why Is SQLite Coded in C? (2017) by jcelerier on Wednesday March 14, 2018 @04:52PM (#16588189)
> You use "volatile" if you don't want the compiler to produce code that caches a variable. You use it all the time in embedded systems, or when writing multi-threaded code, etc.

Thanks for providing a very nice exhibit of the confusion around this. Volatile is 99% useless for multithreading code (unless on MSVC which has a peculiar interpretation of the standard). See https://stackoverflow.com/a/4558031/1495627

Re:Why Is SQLite Coded in C? (2017) by dreta on Wednesday March 14, 2018 @05:34PM (#16588499)
It absolutely is not useless. You're the one confused. I never claimed it's a synchronization construct, or that it magically makes your code thread-safe.

No amount of fences or mutexes is going to help you if threads are operating on their own version of a variable that got cached in a register, or optimised away. You need to understand volatile to write correct multi-threaded code.

That StackOverflow answer is bogus, along with all the other comments. It's just a rant that, albeit correct, is barely related to the question asked, and it's a clear example why you shouldn't treat StackOverflow as more than an unreliable help forum. The guy asked about whether you should make variables shared inside of a critical section volatile. The answer is "yes, to prevent threads from working on stale data".

Re:Why Is SQLite Coded in C? (2017) by DSMan195276 on Wednesday March 14, 2018 @09:58PM (#16589986)
> No amount of fences or mutexes is going to help you if threads are operating on their own version of a variable that got cached in a register, or optimised away. You need to understand volatile to write correct multi-threaded code.

Any properly written Mutex or similar implementation is going to act as a full memory barrier and compiler barrier, meaning variables will already not be cached across lock/unlock. And if you're not properly taking your locks before accessing your variables, `volatile` is not going to save you. The fact is, if you're using a lock to protect a variable, marking it `volatile` gains you nothing and just slows your code down.

> "yes, to prevent threads from working on stale data".

`volatile` absolutely does not guarantee a variable doesn't contain 'stale' data. That's the entire reason you need memory barriers in the first place. Even through the compiler will read a `volatile` variable from memory every time, that memory may still have a stale value in the CPU cache, which `volatile` will do nothing to prevent. Only proper use of memory barriers ensures everyone is working on the same thing, which `volatile` does not do.

Re:Why Is SQLite Coded in C? (2017) by dbaupp on Thursday March 15, 2018 @07:13AM (#16591795)
> Even through the compiler will read a `volatile` variable from memory every time, that memory may still have a stale value in the CPU cache, which `volatile` will do nothing to prevent

FWIW, it doesn't even do this, it's just a compiler-level annotation:

  volatile int x = 0;
  int foo() {
    // read
    int ret = x;
    (void)x;

    // write
    x = 0;
    x = 1;

    return ret;
  }
The 'volatile' ensures that that code results in two reads and two writes. Removing it allows the compiler to optimise down to the equivalent of 'int ret = x; x = 1; return ret;', but both with and without use the exact same read/write instructions (i.e. have the same interaction with the cache): mov on x86 and ldr/str on ARM.
Re:Why Is SQLite Coded in C? (2017) by dreta on Thursday March 15, 2018 @07:46AM (#16591942)
Nobody's arguing that volatile has anything to do with CPU cache, or barriers, or locks, or any other nonsense! volatile is there to ensure that the compiler generates code that accesses the variable directly each time, which is necessary to write correct multi-threaded code. If you don't use volatile, and your code still works, then either the compiler's smarter than you, or you got lucky. End of story. The level of misunderstanding you guys are showing on the matter is beyond comical.

volatile's one of the simplest modifiers to understand if you care to actually learn the language. It has a clear, and well-defined purpouse, and i have no idea how you can spend so much time, and energy arguing that that's not the case.

Re:Why Is SQLite Coded in C? (2017) by dreta on Thursday March 15, 2018 @04:53AM (#16591255)
> And if you're not properly taking your locks before accessing your variables, `volatile` is not going to save you.

Yes, it will! Just because you’re accessing shared variables doesn’t mean you need locks. This is what volatile is for!

You’re blindly hoping the compiler will do the right thing for you, anyway. You must have little-to-no experience writing multi-theaded code in production, let alone anything more advanced that doesn’t rely on locks.

Nobody’s arguing that volatile somehow bypasses the cache. When it comes to multithreading, that doesn’t matter though, because the whole process works with the cache, and the CPU keeps core caches synchronized. Memory barriers do nothing here.

Seriously, you’re arguing rubbish.

Re:Why Is SQLite Coded in C? (2017) by DSMan195276 on Wednesday March 14, 2018 @05:11PM (#16588341)
You do use it on embedded systems, hence my note about using it when accessing things like memory-mapped devices in low-level code (depending on what you're doing). However `volatile` is not at all correct for multi-threaded code and that's a very common misconception. It's really not correct for basically anything except for embedded systems.
Re:Why Is SQLite Coded in C? (2017) by ci5er on Wednesday March 14, 2018 @05:42PM (#16588567)
Stick with 1989, and you donb't have to worry about it.
Re:Why Is SQLite Coded in C? (2017) by 3chelon on Wednesday March 14, 2018 @12:51PM (#16586140)
Well... the declaration you cited resolves down to a pointer to a wide integer. Part of C's simplicity is its small number of keywords, many of which have become way too overloaded as architectures have grown more advanced. The keywords were decided in the 1970s, when address spaces were 16 bits at the most. The ability to create type aliases with `typedef` has added to this apparent complexity, and this has been abused by compiler and OS vendors for decades.

None of it makes the language inherently any more complex, any more than representing machine instructions by long strings of binary makes _them_ any more complex.

Re:Why Is SQLite Coded in C? (2017) by jcelerier on Wednesday March 14, 2018 @01:51PM (#16586770)
> Well... the declaration you cited resolves down to a pointer to a wide integer

With a boatload of associated semantics, quite a bunch bein in practice compiler-dependent (looking at you, MSVC volatile).

And a "protected abstract virtual base pure virtual private destructor" does not mean anything -- or at least any code that compiles.

Re:Why Is SQLite Coded in C? (2017) by saagarjha on Wednesday March 14, 2018 @04:08PM (#16587848)
> With a boatload of associated semantics, quite a bunch bein in practice compiler-dependent (looking at you, MSVC volatile).

Which is not part of C. Your argument that "C is complicated" doesn't work if you cite an egregious misuse of nonstandard extensions.

Re:Why Is SQLite Coded in C? (2017) by 3chelon on Monday March 19, 2018 @03:12PM (#16622039)
Forgive my ignorance here, I'm genuinely intrigued: what's so special about MSVC's volatile as opposed to the regular volatile keyword?
Re:Why Is SQLite Coded in C? (2017) by fao_ on Wednesday March 14, 2018 @12:06PM (#16585759)
C++ =/= C
Re:Why Is SQLite Coded in C? (2017) by Ace17 on Wednesday March 14, 2018 @02:00PM (#16586852)
> Once you become familiar with the language there is not much to lookup in the docs because it's such a small language.

The same could be said about Lisp. Would you trade your C compiler for Lisp one?

Re:Why Is SQLite Coded in C? (2017) by laythea on Wednesday March 14, 2018 @03:37PM (#16587624)
It is not fair to compare Lisp to C. C is much more practical.