On 9/1/2018 3:04 AM, jacobnavia wrote:
> Le 29/08/2018 à 13:11, Bart a écrit :
>> First, the amount of antagonism I received in this group towards me,
>> my views of the language and its associated tools, my alleged poor
>> knowledge of the subject, and the quality of my generated sources, put
>> me off having anything to do with C or making any of my C code public.
>
> The reasons for that antagonism are vey clear:
>
> 1) You are not GNU
> 2) You are not gcc
> 3) You did not learn the c standard by heart
> 4) You did something useful. That is a NO NO in this group.
> 5) You do not respect this group hierarchy (thompson et al)
>
1/2:
Though not really as much on Usenet, recently there has been a lot of
hype over Clang (to the point of them getting borderline antagonistic to
people who work on compilers other than Clang).
ATM though, Clang is one of the few compilers I like less than GCC,
because ugly as GCC is, at least it can be rebuilt from sources within a
reasonable period of time (and at least they haven't come to quite the
same level of "use standards lawyering to justify compiling code in a
way which breaks existing software for maybe a tiny bit more speed on
some popular benchmarks").
Decided to mostly leave out my thoughts about GCC vs Clang vs MSVC for
compiling code on PCs.
Each has their use-cases I guess.
My own compiler (BGBCC) still exists partly as I wasn't really able to
find anything clearly better for my uses (for oddball custom targets).
But, doesn't itself offer much to make a compelling use-case for using
it on x86.
Generally, when building stuff natively on Windows, I use MSVC, mostly
for the benefit of the VS debugger.
In terms of language dialect, mine is most like MSVC, but with the main
exception of using LP64 on 64-bit targets rather than LLP64.
It also generally uses MSVC style command-line arguments, but can
generally accept either MSVC or GCC style arguments.
It doesn't support object files, so attempting to use it to compile to
an object file will produce RIL3 output (which may be used in a similar
manner). Note that ar is not used, nor is the format supported by the
compiler. While the RIL3 format is not itself target-specific, generally
the emitted RIL3 bytecode is target specific.
Superficially, RIL3 is an abstract-typed stack-machine IR, in a similar
vain to MS's .NET / CIL format, though the way it represents metadata is
rather different (metadata is structured as trees of attributes rather
than as a collection of flat interconnected tables).
3/4:
My case, I think I know C well enough.
Sometimes I come across oddball stuff, and wonder how to best support
it. Like, a while ago coming across constructs like this:
float *(arr[3][4])[9];
This one was sort of a 'fun' hack to the typesystem, and stood out as
previously I hadn't been aware that "such a thing was actually a thing".
I have doubts as to whether any of my stuff is all that useful though.
IRL, also people don't seem to believe I know anything about anything,
and attempts to "actually get a job" have ended up as futility.
>
> Happily (for you) you do not propose any changes/improvements to the
> language, so you can ignore this group. That wasn't my case, and I
> endured thompson/heathfield for several years before giving up. They
> destroyed my project after succesfully bullying me out of it.
>
Not really sure what was going on in this case.
In a basic sense, C seems most useful doing "generic C things", where
one can move code readily from one compiler to another. If all the
compilers involved "more or less" support C99, and the added features
avoid interfering with the compiler working effectively to do its job
and avoid creating portability issues, then things are good.
Ideally, what extensions exist can be done in ways where it is possible
to "fall back" if being built on another compiler, or without the
implied hardware features existing within the instruction set.
In this sense, a set of compiler or hardware features may be exposed in
a form resembling an API, just one where many of the functions may "just
so happen" to compile down to specialized instruction sequences.
Likewise for extension keywords, which are ideally handled in ways which
minimize unnecessary compatibility issues (ex: can be safely macroed
away without breaking the code)
Through, granted, this doesn't really cover typical "syntax sugar" style
language extensions, nor features which have a fundamental effect on the
typesystem (ex: extended numeric types).
I have a few other languages as well in my case:
A sort of very incomplete C++ implementation for my C compiler;
My "BGBScript2" (BS2) language (could use a different name);
...
But, C is as C is.
A partial lazy C++ implementation is, at best, a lazy C++
implementation. I thus far don't really claim "any" C++ support, as
almost invariably I would be faced with people raging about how it
doesn't support templates or similar (or how very few features "actually
work").
Almost need a catchy name for an "almost but not quite" C++. There is
EC++, though the feature-set isn't quite a match (ex: mine has namespaces).
BS2 could probably use a different name, as the language has relatively
little in common semantically with most other "Script" languages, but
this is partly a historical artifact.
BS2 isn't supported yet by my C compiler due to inertia (I have another
VM based implementation though where it is used mostly as an "extension
language" for a program mostly written in C). I am not all that sure it
will offer much advantage to a bare-metal use-case over what I can
already do in C (or could possibly be compared with an "extremely
watered down C++" in this case). In a language design / aesthetic sense,
it is along similar lines to Java and C#, but lacks garbage collection,
and makes object lifetime more explicit as per the semantics (and as
part of the language syntax). So, unlike C# or Java, memory objects
don't just "float off into space and disappear", but rather either need
an explicit static lifetime, or to be created/destroyed manually via
new/delete, or dynamically via constructor/destructor logic (similar to
RAII).
There would be a bit of overlap on the ABI side between BS2 and C++,
though semantics and basic language features differ some between the
languages, so still only a fairly limited set of features could be
shared directly across the language barrier (ex: one language uses
single inheritance + interfaces, whereas the other uses multiple
inheritance, ...). ( On the C++ side, the interfaces could be expressed
as abstract classes. )
There are also some uncertain areas, for example, BS2 arrays are
normally bounds-checked but C-style arrays (and raw pointers) are not,
which creates an awkward edge case (the bounds checks being arguably an
unreasonable use of clock-cycles, and are not terribly easy to optimize
away in many cases). Though, the language still allows C-style pointers,
so it isn't like "all hope is lost" (and since I control the CPU ISA in
this case, adding special instructions for this isn't entirely out of
the question).
The way some parts of the compiler and ABI were being designed as to
support both C++ and BS2, since granted there is still some amount of
overlap in terms of "fundamentals" (ex: both will have objects and name
mangling, ...). Similarly, some C extensions exist partly as a
side-effect of features intended to be able to support BS2.
Also unclear is the tradeoff between:
Put more priority into lazy C++ support;
Put more priority into adding BS2 to this compiler;
Put effort into trying to add both;
Not bother, C is enough.
In any case, I would probably expect C to remain as the dominant
language in this case (C being the language I use the most in-general).
Or such...