Some information for the one who decided to learn C++, and now wantsto learn at least a bit of C?

A

Alexander

Some time ago I decided to learn C++, and most of the documentation I
found (books, tutorials, etc) said that not only is it not necessary
to learn C before, it is not recommended since it could make things
more difficult.

Now I know C++, but I deal a lot with various C software, and although
I understand it all, it is not at all easy to adapt it to my needs.

Where should I search for information? I couldn't find anything useful
on Google (and it's not that easy to find a good search query).

Could you advise me? Any responses are welcome.
 
B

BGB / cr88192

Alexander said:
Some time ago I decided to learn C++, and most of the documentation I
found (books, tutorials, etc) said that not only is it not necessary
to learn C before, it is not recommended since it could make things
more difficult.

Now I know C++, but I deal a lot with various C software, and although
I understand it all, it is not at all easy to adapt it to my needs.

Where should I search for information? I couldn't find anything useful
on Google (and it's not that easy to find a good search query).

Could you advise me? Any responses are welcome.

well, just my thoughts:
there are 2 major camps within C++ land.

the "C/C++" camp, who see C++ as mostly a superset of C, and will use
whatever styles from both languages they feel is most appropriate (and do
such "horrors" as use both languages in the same codebase, ...).

the "C++ purist" camp, who tends to see C++ more in relation to C# or Java,
and who tends to despise C and its C heritage. they are more likely the sort
of people who would make the previously mentioned comments.

these 2 camps fight in a sort of never-ending style-war...


personally, I tend to use mostly C, and use C++ "here and there", but tend
to use it rarely both as it creates problems for my technology, and because
really I don't usually need most of what it offers (most of its useful
features are either syntax sugar or can be otherwise easily done differently
in C).

also, one can do OO in C, the main thing about it is to not try to make it
syntactically resemble C++ (as this is where the pain starts). my "style"
then is much more influenced by other systems, such as Self and CLOS.

and, yes, a lot of this can be wrapped in C++-style classes, but usually I
don't bother...
(if I am writing C++ code, I personally have no fear of C-style API's...).

"style" is largely a false religion anyways...
no more valuable than nitpicking about when and where one puts their stupid
whitespace.
the compilers don't have reason to complain, and most humans should stop
complaining about pointless differences in convention or style.


it is about as "real" as people making a fuss over one "shouldn't" stir
their coffee with a knife or fork, and me being like "whatever dude...". I
really don't care what piece of silverware goes with what task, as long as
it works this is all that really matters...


so, effectively, I fall in a somewhat different camp...
 
I

Ian Collins

well, just my thoughts:
there are 2 major camps within C++ land.

the "C/C++" camp, who see C++ as mostly a superset of C, and will use
whatever styles from both languages they feel is most appropriate (and do
such "horrors" as use both languages in the same codebase, ...).

the "C++ purist" camp, who tends to see C++ more in relation to C# or Java,
and who tends to despise C and its C heritage. they are more likely the sort
of people who would make the previously mentioned comments.

these 2 camps fight in a sort of never-ending style-war...

Do they? I wonder where...
 
B

BGB / cr88192

Richard said:
Bullshit.

probably fair enough, but these sorts of claims are often made by those
people who use C++ but despise C and so try to pretend that C++ is Java or
something and berate anyone who tries to "define" C++ by using "C-like"
API's or coding practices...

the problem then is that if a person knows C first, it is much more
difficult for them to ram all their crap down the newb's throat, as the newb
may realize that they actually have a choice, and that "style" is a matter
of both personal preference and utility, and not something which is set in
stone...

Roll up your sleeves and read K&2 2. If you can program C++ then "your
needs" are just a downgrade away.

well, unless the person has managed to only learn the "OO propaganda"
version of C++...
(newb: "what does the '*' mean between the class name and the variable
name?", response "!! it is pure evil! don't gaze into its existence any
further!"...).


but, anyways, I am not sure about "K&R 2", as I can't pull up info on it at
the moment.
but, ideally, any book the person uses to learn C should cover C89 and C99,
as older C variants are, anymore, not so much worth covering.
 
O

osmium

BGB / cr88192 said:
probably fair enough, but these sorts of claims are often made by those
people who use C++ but despise C and so try to pretend that C++ is Java or
something and berate anyone who tries to "define" C++ by using "C-like"
API's or coding practices...

the problem then is that if a person knows C first, it is much more
difficult for them to ram all their crap down the newb's throat, as the
newb may realize that they actually have a choice, and that "style" is a
matter of both personal preference and utility, and not something which is
set in stone...



well, unless the person has managed to only learn the "OO propaganda"
version of C++...
(newb: "what does the '*' mean between the class name and the variable
name?", response "!! it is pure evil! don't gaze into its existence any
further!"...).


but, anyways, I am not sure about "K&R 2", as I can't pull up info on it
at the moment.
but, ideally, any book the person uses to learn C should cover C89 and
C99, as older C variants are, anymore, not so much worth covering.

In you first paragraphs you seem to advocate language tolerance. In you
last paragraph, by forcing C99 coverage you are excluding most of the
community of real C programmers, and the best manual ever written (K&R) for
*any* programming language. Most C programs are written in C89 with a dash
of C99 here and there.

I suggest the OP type <c99 compliant> in to Google before he tries to follow
your advice.
 
O

osmium

BGB / cr88192 said:
AFAIK, the K&R manual mostly deals with pre-ANSI C?...

like, its purpose was to form as a de-facto reference early on in the
languages' development, prior to the standards coming along and largely
regularizing everything and establishing a lot more of the more modern
syntax and semantics.


note that I listed both C89 and C99...
the common subset of C89(AKA: C90) and C99, covers nearly all compilers
currently in use.

not so many pre-ANSI compilers are still in use.


I still believe this is a position of tolerance, only that tolerance may
be moderated by pragmatics.
idealistic adherence to a particular style is pointless, but writing code
which doesn't work (well or at all) is not useful either.



whoever said I was advocating trying to be "C99 only"?...

You said:
any book the person uses to learn C should cover C89 and C99, as older C
variants are, anymore, not so much worth covering.


You're a programmer and you are supposed to know what the word "and" means.
It seems now that you actually meant and/or, which has an entirely different
meaning, I have no problems if that is what you meant.
 
I

Ian Collins

probably fair enough, but these sorts of claims are often made by those
people who use C++ but despise C and so try to pretend that C++ is Java or
something and berate anyone who tries to "define" C++ by using "C-like"
API's or coding practices...

Where do you get all this nonsense from? You must read some pretty
weird stuff.
well, unless the person has managed to only learn the "OO propaganda"
version of C++...

Wow, something else I've never come across in almost 20 years of C++
programming.
 
B

BGB / cr88192

Richard Harter said:
Er, to tell the truth, I have no idea what you think or thought
he meant, and what you wrote had to do with what he wrote. I
understood him to be saying that older variants, i.e. those
preceding C89 are not worth covering. On the other hand it
should cover both C89 and C99. What on earth do you think "and"
means?

yes, this is more what I meant...

stuff before C89 is sort of crufty and has much variation and little
standardization, and so is not as useful trying to learn it.

hence, C89 and C99, as in, it is good to look into both, and know what each
supports and what each lacks, ...
 
B

BGB / cr88192

Keith Thompson said:
BGB / cr88192 said:
AFAIK, the K&R manual mostly deals with pre-ANSI C?...
[...]

The first edition of Kernighan & Ritchie's "The C Programming
Language" (K&R1) covers the C language as it existed in 1978, long
before the ANSI standard. This version of the language is often
referred to as "K&R C", and is largely obsolete.

this is what I was originally concerned over.

since my search on "K&R 2" didn't turn up much, I was unsure and thinking
maybe it was a reference to this older book (since most people make a new
edition of a book every few years or so, and I wasn't sure what the actual
name of the book was, ...).

The second edition, K&R2, covers the language described by the
1989 ANSI C standard and the 1990 ISO C standard. (My copy says
"Based on Draft-Proposed ANSI C" on the cover; later printings have
different wording.)

There are no plans for a K&R3 to cover C99.

ok, yes...

so then these are probably a good reference then...
 
B

BGB / cr88192

Ian Collins said:
Where do you get all this nonsense from? You must read some pretty weird
stuff.

much of it comes from usenet...

just how many flame wars have I read over the years?... hell, I don't
know...

Wow, something else I've never come across in almost 20 years of C++
programming.

yes, but I have been doing > 10 years of usenet posting, and I have heard
all sorts of claims...

now, whether or not this is a majority position, or is just held by the
occasional troll, I have little idea...

I recently ran into a teacher in a class IRL who was going on like this
(very much one of those "C is arcane", "the only true way to do programming
is through Visual Studio", ...) people.

and, yes, they exist...

they exist, they occasionaly make themselves known on usenet, and they teach
introductory programming classes at community colleges...

I don't know as much what most real-life people are like, as, sadly, my
social life doesn't extend too far beyond the borders of usenet and the
occasional web forum at this point...

in the "real world", I almost don't really exist...
 
K

Keith Thompson

BGB / cr88192 said:
ok, yes...

so then these are probably a good reference then...

I'm not sure what you mean by "these".

K&R1 is a classic, and was an excellent book in its time, but it's not
all that useful as a reference unless, for some reason, you need to work
with an ancient compiler.

K&R2 is mostly more of a tutorial than a reference, and is widely
considered to be one of the best programming books of any kind.

Harbison & Steele's "C A Reference Manual", currently in its 5th
edition (H&S5), is an excellent reference book; it covers both C90
and C99.

Section 18 of the comp.lang.c FAQ mentions some good references.
 
B

BGB / cr88192

Keith Thompson said:
I'm not sure what you mean by "these".

K&R1 is a classic, and was an excellent book in its time, but it's not
all that useful as a reference unless, for some reason, you need to work
with an ancient compiler.

K&R2 is mostly more of a tutorial than a reference, and is widely
considered to be one of the best programming books of any kind.

Harbison & Steele's "C A Reference Manual", currently in its 5th
edition (H&S5), is an excellent reference book; it covers both C90
and C99.

Section 18 of the comp.lang.c FAQ mentions some good references.

yep.

I meant mostly K&R 2...
although I have not actually seen it personally, since it was written by the
original creators, it has added weight of authority...

or such...
 
B

BGB / cr88192

io_x said:
in what i think
the above is very wrong

that their views or wrong, or claiming that it is wrong to claim that people
exist who hold such views?...


IMO, yes, these sorts of claims are disagreeable (what with me being a
person who uses C and Makefiles and similar...).

however, there are Java zealots, and C# zealots, and even C++ zealots...
and there are people who insist that IDE's are the one true way of doing
builds, ...


then I have been accused of being a C zealot.
and arguments have gone on regarding my personal choice to use Makefiles and
Notepad for code editing and builds, and disagree that OO is the one true
solution to all life's problems, ...

oh well sometimes...


the ideal solution would be one where the different languages have much
better interop, and so it would be much easier to mix and match parts
without having so much of a hassle, and preferably without having to sell
oneself to some all-encompasing piece of VM technology (be it JVM or .NET or
even LLVM...).

ideally, the choice of VM or compilation strategy should be separate from
the choice of language.

but, in reality, there are borders, and where there are borders one will
declare their preferred anthill to the the one true anthill...

all is costs and benefits, of endless special-cases and tradeoffs.
no one gets everything right, so the effort is to at least look for
something adequate.

and there is yet the risk of creating ones' own piece of all encompasing VM
technology, leading to uncertainty if there even is any real solution to
these problems, and if these problems will exist indefinately. usually the
best one is left to hope for is for dust to settle and one gets some
mediocre de-facto standards.


in the end, the best one can hope for is some eventually arbitrary decree:
and 2 prongs with a certain defined shape and distance will be inserted into
a plug with a certain defined voltage and frequency...


or such...
 
I

ImpalerCore

that their views or wrong, or claiming that it is wrong to claim that people
exist who hold such views?...

IMO, yes, these sorts of claims are disagreeable (what with me being a
person who uses C and Makefiles and similar...).

however, there are Java zealots, and C# zealots, and even C++ zealots...
and there are people who insist that IDE's are the one true way of doing
builds, ...

then I have been accused of being a C zealot.
and arguments have gone on regarding my personal choice to use Makefiles and
Notepad for code editing and builds, and disagree that OO is the one true
solution to all life's problems, ...

I can see the pros and cons for IDE vs Makefiles, C++ vs C, but
Notepad? Of all the editors available, you're satisfied with Notepad?

I couldn't live without my ":line number", "/search", and "ma d'a" (ok
I could, but I wouldn't like it).

<snip>
 
B

BGB / cr88192

that their views or wrong, or claiming that it is wrong to claim that
people
exist who hold such views?...

IMO, yes, these sorts of claims are disagreeable (what with me being a
person who uses C and Makefiles and similar...).

however, there are Java zealots, and C# zealots, and even C++ zealots...
and there are people who insist that IDE's are the one true way of doing
builds, ...

then I have been accused of being a C zealot.
and arguments have gone on regarding my personal choice to use Makefiles
and
Notepad for code editing and builds, and disagree that OO is the one true
solution to all life's problems, ...

<--
I can see the pros and cons for IDE vs Makefiles, C++ vs C, but
Notepad? Of all the editors available, you're satisfied with Notepad?

I couldn't live without my ":line number", "/search", and "ma d'a" (ok
I could, but I wouldn't like it).
-->

jumping to specific line numbers, ... is supported by Notepad.


well, now I also generally use Notepad2 now for code editing, but either way
doesn't make much difference...
(tried a few other editors as well, but many were following the "MDI
button-frenzy" school of UI design...).

the main merit of Notepad though is that it is fairly light weight and
responsive, and comes with Windows (so no need to manually install it or set
it up...), so one can have a bunch of editors open (up to around 50+ on
WinXP, but only around 20-30 on Vista and Win7), without other adverse
effects and without bogging things down.


OTOH, Visual Studio, ... tend to be much less responsive, and the UI isn't
well designed for having lots of stuff open, for quickly changing from one
task or another, ...

although being able to build and run in a single keypress is convinient...
and VS does a few things well, but in many cases it is a bit "large and
heavy" as far as UI design goes. and, say, having to wait around 250ms - 1s
or more after clicking of stuff and having VS actually do it is annoying
(like, I almost may as well be coding via a web-interface or similar...).

as with most IDE's, it also wants to do all project management and building
itself, which is an issue (like, if there were a good and easy way to
combine Makefiles, batch files, and custom tools into the overall build
process, ... this would be a little better). (but, hell, at least on this
front VS is still better than Eclipse, which hard-codes everything, whereas
VS mostly just makes it a hassle and leaves one doing a combined IDE-build
and commandline build...). VS does have extra merits WRT .NET apps though,
since otherwise there is no good way to do WinForms...

(then one has a big ugle mess of C, C++/CLI, C#, and ASM, all in the same
app, but whatever...).
(oh yes, even something as simple as putting C# and C++/CLI in the same
project is a hassle with VS, but at least it does work when one can manage
to make it do so...).

and, a lot becomes layers, with my bottom layers often following a strict "C
only" policy...
Java would almost be preferable, except plugging together C and Java code is
more effort than plugging together C and C# (since in the latter case, there
is C++/CLI, which can sort of sit around as a sort of DMZ between the 2
worlds, whereas JNI is decidedly more nasty...).

luckily, none of my main projects have done this though (most of this has
been for tests and side-projects, where my official policy is to not start
using C# or Java in main projects until I have a generally better way to
interface them with C land).


so, yeah, everything works well enough in general...

although anymore, I am left sometimes wishing Make was a little faster (more
time is spent waiting for Make than is spent waiting for the compiler...).
( > 1Mloc means invoking Make is a time to go get coffee...).


or, if I could have more editors open, something to avoid unintentionally
having the same file open multiple times, and maybe some ability to
autogroup editors, ... (say, by file type and by location, ...) everything
could be a little nicer.

but, all is good enough...
 
I

Ian Collins

the main merit of Notepad though is that it is fairly light weight and
responsive, and comes with Windows (so no need to manually install it or set
it up...), so one can have a bunch of editors open (up to around 50+ on
WinXP, but only around 20-30 on Vista and Win7), without other adverse
effects and without bogging things down.

50 editors? The mind boggles. I have a *lot* of screen real estate and
I only ever have one (with 3 frames) open.
 
B

BGB / cr88192

Ian Collins said:
50 editors? The mind boggles. I have a *lot* of screen real estate and I
only ever have one (with 3 frames) open.

well, a lot may be open, mostly as I tend to partition code down into approx
500 loc to 1 kloc source files (much above 1 kloc, and a source file takes
too long to scroll through and look at stuff), and tend to break libraries
apart into ~ 10-50 kloc chunks (much above about 50 kloc, and a single
library becomes unmanagable, around 25-30 is typical...).

50 editors could then mean having most of a library open at the same time,
or more commonly parts of several different libraries which I might be
working on...


however, Vista and Win7 seem to have a lower limit on the number of editors
that can be open, which in some cases can hinder activity.

20-40 editors is more typical though.

usually, if I switch between tasks (say, going to working on a different
part of the project), all the editors will usually be closed, and then
allowed to re-propagate.

typically, the main way of accessing them is because they tend to stack on
the taskbar, so often the taskbar is used to select the one I want, ...

(so, it is improvements to Windows itself that make manually using editors
and the command shell more usable...).


or such...
 
N

Nick Keighley

I've used both makefiles and IDEs. IDEs tend to encourage simpler
project layouts and I confess the more esoteric makefiles I find hard
work.

You can use Visual Studio with C as well...

that their views or wrong, or claiming that it is wrong to claim that people
exist who hold such views?...

IMO, yes, these sorts of claims are disagreeable (what with me being a
person who uses C and Makefiles and similar...).

however, there are Java zealots, and C# zealots, and even C++ zealots...

they're partly understandable. They wouldn't be using a particular
tool if it didn't suit them at some level better than the alternatives
(though sometimes the reason is just inertia). I tend to just ignore
the more zealous.
and there are people who insist that IDE's are the one true way of doing
builds, ...

then I have been accused of being a C zealot.
and arguments have gone on regarding my personal choice to use Makefiles and
Notepad for code editing and builds,

I'm sure there must be something better than Notepad... Have you
looked at ConText? Easy to use but with a few features like syntax
highlighting (I can hardly ever stand the default settings) and
indenting.
and disagree that OO is the one true
solution to all life's problems, ...

nothing is the solution to everything
oh well sometimes...

the ideal solution would be one where the different languages have much
better interop, and so it would be much easier to mix and match parts
without having so much of a hassle, and preferably without having to sell
oneself to some all-encompasing piece of VM technology (be it JVM or .NET or
even LLVM...).

I'm not sure this is even doable. The variation in environments is so
vast. I'm not sure I want .NET in my anti-lock brakes.

Some manufactureere have acheived good levels of integration (DEC VMS
you could mix components from various languages fairly freely) (maybe
Apple too). But of course this all fell apart when you changed
platforms.
ideally, the choice of VM or compilation strategy should be separate from
the choice of language.
yes...

but, in reality, there are borders, and where there are borders one will
declare their preferred anthill to the the one true anthill...

all is costs and benefits, of endless special-cases and tradeoffs.
no one gets everything right, so the effort is to at least look for
something adequate.

I'm not convinced that what you want is actually possible.
and there is yet the risk of creating ones' own piece of all encompasing VM
technology, leading to uncertainty if there even is any real solution to
these problems, and if these problems will exist indefinately. usually the
best one is left to hope for is for dust to settle and one gets some
mediocre de-facto standards.

I'm not convinced that language interoperability needs VMs
in the end, the best one can hope for is some eventually arbitrary decree:
and 2 prongs with a certain defined shape and distance will be inserted into
a plug with a certain defined voltage and frequency...

or such...

where I come from electrical plugs have three prongs
 
N

Nick Keighley

what does it mean 1 kloc? it means 1_000 lines?

LOC = Lines Of Code
KLOC = KILO (1000x) Lines Of Code

often comments and blank lines are excluded from the count
it is the subject of Great Flame Wars how useful such counts are
 
B

BGB / cr88192

Nick Keighley said:
I've used both makefiles and IDEs. IDEs tend to encourage simpler
project layouts and I confess the more esoteric makefiles I find hard
work.

You can use Visual Studio with C as well...

yep.

for Makefiles, I tend to use a lot of copy/paste/edit.
namely, I found a structure which works fairly well, and copy and edit it to
deal with the specifics of the new piece of code.


VS works, but more in the "quickly beat together something small and simple
with a GUI" sense...
sometimes I end up combining some of VS's tools with an otherwise
command-line build, ...

however, most of the stuff I build tends to be largish, and VS doesn't seem
particularly well suited to managing and building larger projects (could
work, but likely to involve manually hacking some stuff).

they're partly understandable. They wouldn't be using a particular
tool if it didn't suit them at some level better than the alternatives
(though sometimes the reason is just inertia). I tend to just ignore
the more zealous.

yep.

I don't care what they use...

I'm sure there must be something better than Notepad... Have you
looked at ConText? Easy to use but with a few features like syntax
highlighting (I can hardly ever stand the default settings) and
indenting.

I am using Notepad2 some now, but a lot of these arguments took place before
using it, and the difference is not all that drastic...

it is like, ones' task is to edit text.
since most usable text editors do similar stuff and have similar UI's, there
is no real strong difference between them IME...

nothing is the solution to everything

yep.



I'm not sure this is even doable. The variation in environments is so
vast. I'm not sure I want .NET in my anti-lock brakes.

Some manufactureere have acheived good levels of integration (DEC VMS
you could mix components from various languages fairly freely) (maybe
Apple too). But of course this all fell apart when you changed
platforms.

yeah, that is another problem...

a lot of my effort has ended up going into designing and implementing
typesystem and ABI mechanics...
I have an ABI, which is partly combines parts of other ABIs (notably the
IA64 C++ ABI / GCC C++ ABI, JVM, and parts of MSIL).


part of the trick is getting all of these languages to use compatible ABI's
and typesystems, which MS was partly right about this part (trying to
crazy-glue all of the different systems together gets nastier faster).

however, each language can still have its own specific typesystem and
semantics, as it is not so much that "language A has the same types and
semantics as language B", but rather that commonality can be reached at the
ABI level.

like most C++ ABI's, mine directly builds upon the C ABI.
sadly, at the moment, direct C++ compatibility is unlikely (C++ needs to
interface at the C level).

I ended up not directly using the existing C++'s as they didn't match
exactly with my uses (however, the IA64 / GCC C++ ABI has contributed
notably to much of the core type notations, ...). however, a lot of other
syntax conventions came from the JVM, and some minor features came from MSIL
(mostly adding the ability to encode things like calling-convention and
access modifiers into signature strings, ...).

also things like generics can be represented, however the notation can't
currently handle C99 VLAs (VLAs pose technical problems at several levels,
and are thus far unimplemented). a likely eventual strategy could be to
silently convert it into a dynamic array.

int arr[x];
silently becomes (analogous to):
int[] arr = new int[x];


however, a few things create issues at the ABI level:
good GC mechanics (currently I have conservative GC, and there is no obvious
way around this for now);
lexical closures (currently these are a hack involving allocating GC'ed
executable memory objects);
full continuations (there is no good way I know of to pull this off without
making a horrid mess).

exist only continuations are possible, but some languages (such as Scheme)
expect full continuations.
the issue is that there is no good way to support these (at least for
mixed-language stack frames).
currently I don't officially support Scheme, but a half-assed form exists as
it was used as the basis of the IL for my BS language (partial ECMAScript
variant).


and even simpler things:
reliable stack unwinding (mixed-language stacks and using optimizing
compilers tends to foul up stack unwinding, since some compilers consider it
a good idea to omit frame pointers, ...);
inter-language base-type naming issues (names of base types in one language
may be different than in other languages);
inter-language dynamic-type naming issues (some languages, such as
ECMAScript and friends, happen to specify the names of various dynamic
types, which don't match what my stuff uses internally, hence requiring
rename hacks...);
....

for example:
_fixint_t, _flonum_t, _int_t, _float_t, _long_t, _double_t, ... all map to
the ES/JS "number" type.
(an underscore prefix is generally used for all types which are part of the
framework itself).


given JS supports:
if(typeof(x)=="number")
...

no clean solutions exist.


sadly it is not at present...

given I can't portably compile Java or C# directly to native code, use a
wide variety of non-"JVM" languages on the JVM (like C and C++).


C# is also tied to .NET, with no real direct native options (although on
Windows the difference between .NET and native is minor, but apart from
Windows, the border is not so clean...).

for example, the main convinient way I had found for using .NET with a C
codebase was to have a DMZ of C++/CLI, so both C# and C can interface with
this DMZ, and thus with each other.

however, AFAICT, this strategy does not work with Mono or others (one has to
resort to the decidedly less clean P/Invoke strategy, although at least it
is still probably less awkward than JNI...).

compiling C# to native code which could work on both Windows and Linux and
interface more directly with C would be preferable.


however, I am unlikely to ever really fully support C++, so if I were to do
a C++/CLI analogue, it would likely be a sort of faux-C++ (and likely
technically closer to a hybrid of C and C# than a true C++...).

on my framework, most non-C facilities can be accessed via API calls, but
this of course lessens the ideal of framework independence (where, ideally,
my stuff should not even entirely depend on my own stuff, although
practically this is unavoidable).

I'm not convinced that what you want is actually possible.

it may not be.

I was writing about an ideal world, rather than a realistic world.
however, there is still more that can be done...


apart from whether any such ideals can be realized, costs, benefits, and
tradeoffs still exist (within the current world), and no particular choice
is universally better than the others.

one person chooses C (and native), another C# (via .NET), and another Java
(via JVM).
each with their own merits and costs...

I'm not convinced that language interoperability needs VMs

part is how one defines a VM...

but, at least in the more traditional sense (JVM, .NET, or things like the
Flash or Python VM), no, probably not...

interoperability itself needs common ABI's...


sadly, a language like Java or C# (or JavaScript) needs a good deal of
runtime support to actually work...

in this case, a "VM" may exist, but more as a big set of runtime facilities
and possibly codegen machinery, rather than a bytecode-based interpreter or
JIT engine.

my strategy is more in trying to provide most of the facilities, and thus
far I have *no* standardized bytecode (most of the code is statically
compiled native code, or is compiled at runtime typically from source-code
or generating code at runtime).


most of the overall structure is similar to that found in a more traditional
compiler (such as GCC).

I tried to keep the design much more orthodox than in LLVM and friends (some
people push for me to use LLVM, but as is it would still be fairly painful
to try to plug it into my framework...).

hence, I am still left writing my own compiler machinery.

where I come from electrical plugs have three prongs

depends on the plug...
either way, it is still an arbitrary decree...


here in the US, there are usually 2 flat blade prongs (at 110-120VAC and
60Hz), and sometimes an optional 3rd prong used for grounding (mostly on
computers and similar). then there are the much larger 3-blade plugs
(240VAC), usually used for dryers, stoves, welders, and similar...

many other places it is 2 or 3 round prongs, usually at 240VAC and 50Hz
AFAIK and with a wider prong spacing.

then one can switch between them via transformer boxes...


sometimes it would be convinient if there were 12VAC power available in
houses, say then using rectifiers in the power boxes to have 12VDC
available.

or such...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,114
Members
46,702
Latest member
VernitaGow

Latest Threads

Top