Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C-Based languages

Name: Anonymous 2012-07-19 21:01

C is an amazingly designed language.  It's beautiful, simple, elegant and fast.
Everything a well designed programming language should be.

C++ then came along and shit all over Dennis Ritchie's masterpiece.  Bjarne took a beautiful, simple, elegant and fast language. And kept shitting on it until all that was left was 'fast'.  Dennis should of beat the shit out of him for turning his work of art into an abomination.

Then Gosling came along, surveyed the turd that Bjarne had dropped, and attempted to clean it up.    He redesigned C++ to remove the crap and attain the elegance that C had.  Unfortunately, in his cleaning frenzy, he over-simplified the language and sacrificed speed.  In the name of simplicity he removed pointers, manual memory management,  generics, operator overloading and native code compilation.  A noble effort, but ultimately just as much of a failure as C++.

Name: Anonymous 2012-07-20 15:47

>>39
there are basically only 4 embedded programming languages used, C, C++, Ada and a very small percentage of Java. you can find that information anywhere on the net that lists use of embedded programming languages by popularity

Name: Anonymous 2012-07-20 16:09

>>41
and just to add, I wasnt able to find a list of embedded programming languages in a web search, but if you did find that C by far the most

Name: Anonymous 2012-07-20 16:20

>>38
I'd rather use assembly in that situation than having to be stuck with C's shittyness.

Name: Anonymous 2012-07-20 16:50

Check my IEEE 754 doubles.

Name: Anonymous 2012-07-20 17:33

>>41
You missed everyone's favorite specialty embedded language family, which is more important to phones than Java ever was or will be.

Name: Anonymous 2012-07-20 17:35

>>36
Go is not well designed, ignoring 40 years worth of advances in PLT is not good design.

>>38
C's type system and control on the actual representation of the data is laughably bad and you should feel bad. Ada might be a verbose piece of shit, but it's still years ahead of C.

Name: Anonymous 2012-07-20 18:02

C, C++, Ada, Java
[citation needed]

Fine:
C
Java: Though completely inexistent outside Android, shitphones and some hobbyist stamps.

Sorta:

C++: U MENA Embedded C++ (scoffed by Bjarne), and repackaged g++ (depending on the target), complete C++ compilers for embedded are probably rare.

Contested:

Ada: Inexistent outside defense and aerospace, exactly one compiler (GNAT) for exactly one kind of 8-bit microcontroller (AVR) that I'm aware of. Green Hills' Ada compiler doesn't target ARM and some other target architectures you'd like to have these days.

Missing:

Forth: a rather large amount of compilers (always the case with Forth) for every chip target imaginable. Some chips currently ship with Forth such as the 144 core GA144.

BASIC: Microchip (4th largest in revenue share from microcontrollers in 2011) lists 3 premier third party compilers on their site: 2 are C and C/C++ and the other is PICBASIC PRO, that should say something.

Wiring: Processing derivative, used on Arduinos, confused with C++ sometimes.

Pascal: STMicroelectronics (9th largest in revenue share 2011) lists MikroPascal on their third party tools page. JAL for the Microchip PIC devices is similar to Pascal.

Interesting:

Lisp: Lisp was used on some NASA projects. Deep Space 1's Remote Agent was written in Common Lisp, was subsequently named "NASA Software of the Year". Butthurt SEPPLES coders tried to rewrite the planner to C++ but failed after a year. Whenever Lisp show up in embedded at all, its usually some type of robotics. Kinda inappropriate for cheap micros.

Python/Lua/Scheme subsets: Exists micro-interpreters for all of these to fit in small micros.

LOGO: Robot turtles, a lot of them.

Name: Anonymous 2012-07-20 18:30

>>19
simple enough to visualize the actual instructions from the source code.
Only if you're using a non-optimizing compiler that doesn't make good use of your CPU.
>>31
C is too low level
Not true. C is not low level enough for low level usage and not high level enough for high level usage. BLISS and PL/M are low level, in the sense of controlling CPU instructions and registers and being able to do whatever your CPU can do. They have the full power of the assembly language. You can write a boot-loader or kernel in those languages without any inline assembly. C has far fewer capabilities than any hardware architecture. Even MIPS I, which is practically a "C machine," has overflow checking. Good C compilers can turn loops into single instructions even on RISCs. It's better if the programmer is able to say what they mean instead of writing a loop and having the compiler guess.
>>38
no other language that gives such static control of data on memeory
Compared to many languages (such as PL/I or COBOL), C has terrible control of data in memory. You can't do anything about integer overflow. Dividing by zero is undefined behavior (not a signal, that's POSIX). You can't even tell C how you want structures to be aligned to simplify I/O (even if it causes a huge performance penalty).

Name: Anonymous 2012-07-20 18:33

>>48
Fuck off and die in a fire, C apologist.

Name: Anonymous 2012-07-20 18:35

>>46
What has been ignored in Go's design in your opinion? Every time I've heard this the person apparently expected another Haskell or C++. From the perspective of expecting C with some extra things, I find Go not bad.

Name: Anonymous 2012-07-20 18:47

>>49
I don't see anything ``C apologist''ic there. ``Jew'' quote the wrong post?

Name: Anonymous 2012-07-20 19:05

C#

Name: Anonymous 2012-07-20 19:27

>>47
you offer a very interesting counter evidence for embedded languages, I'll give you partial credit for contradicting me. Its worth commenting on why its only partially corrrect:

C++- its not used as much as C, but it is the second most used. I recommend you listen to this podcast of Bruce Powell Douglas who uses runable UML to design Real Time systems (like flight controls that have a severe time limit in reacting to input)
http://www.se-radio.net/2007/10/episode-73-real-time-systems-with-bruce-powel-douglass/
this guy is a strong proponent of using OO in embedded systems

Forth- Yes that is true that forth is by for the most popular language for testing embedded electronics. But I would counter that it is only used as a testing language and rarely used for production code except on systems where code has to be changeable on live running systems like satellites. I dont have proof to back this statement up though so I will give you credit.

BASIC- Im aware there are some BASIC compilers for microcontrollers like PIC, but I think it is only used because its an easy language to teach. The common standard of BASIC would not work as it had a very primitive type system that would not be suitable for electronics. So partial credit.

Wiring- that is just Java/Processing. Most guys I know who are serious about programming microcontrollers dont consider Arduino to be a serious learning tool and just something to help hobbyists avoid hard issues in embedded programming. no credit

Pascal- the fact that the original Pascal standard was never good enough to make production code has to do with it being designed as a teaching language and not a production language. This is where C got its reputation for being a serious programming language by beating out Pascal for professional use. The fact is that Pascal produces that is as fast and efficient as C but is much safer. So Pascal/Delphi died an undeserved death against C. I'll give you full credit for disproving me although I dont know of anyone who uses it for embedded programming.

Lisp- Im aware it has been used for the same purpose as Forth, it is not as efficient as Forth requiring garbage collection and a large runtime

Python/Lua/Scheme- there have been rare occasions that a scripting langauge has been used in writing drivers, but these are very inefficient for this role. partial credit

Logo- this is not embedded electronics, its a program that runs on an OS. no credit

Name: Anonymous 2012-07-20 19:34

>>50
Lack of parametric polymorphism and polymorphic containers (except when they decide to not) and using tuples instead of a tagged union for errors are the real deal breakers.
The latter is just plain retarded.
The former is just as retarded, but it's even worse because you have to choose between useless code repetition, or (typesafe) void* casts.
Also, the asinine 32-bit GC implementation, but that's not part of the language itself.

Name: Anonymous 2012-07-20 19:46

>>54
polymorphism is really a non-issue for Go, Go does not try to do OO, polymorphism only works for identifying sub-types and inheritance some would argue is the worst part of OO, the kind of thing that Torvalds would argue you cant back out of once its set without redesigning the entire code. And polymorphism is really the worst part of inheritance as you are basically doing pointer arithmetic on objects, something the designers of Go want to avoid

Name: Anonymous 2012-07-20 19:58

>>55
What you're describing is subtype polymorphism. Actually, one particular implementation of a particularly bad formulation of it. But that was not my point.
I was talking about parametric polymorphism.

swap[T](T* x, T* y) T {
  T tmp = *y;
  *y = *x;
  *x = tmp;
}

int a, b;
float c, d;
...
swap(a,b) // typechecks and works.
swap(c,d) // typechecks and works.
swap(a,c) // compile-time type error: `a' and `c' are different types.

Name: Anonymous 2012-07-20 19:58

>>16
dOnT uSe tHE == oPeRaToR

Name: Anonymous 2012-07-20 20:07

>>56
>But that was not my point. I was talking about parametric polymorphism.
why dont you just say function overloading instead of using fancy terminology?

and youre using typeless pointers in this example, the kind of thing Go wants to avoid. The nice thing about C is that it avoids name mangling that is involved in making overloaded functions work in C++

Name: Anonymous 2012-07-20 20:16

>>58
why dont you just say function overloading instead of using fancy terminology?
Because it's not.
Goddamnit, I hate Gotards pretending to know it all.

Name: Anonymous 2012-07-20 20:16

Also, learn to quote and go back to /g/, >>58.

Name: Anonymous 2012-07-20 21:05

If it ain't Prolog, it ain't logical and you might as well be pink astronaut bunnies elephant.

Name: Anonymous 2012-07-20 21:54

even Delphi was able to produce code that was as fast and efficient as C.
http://dis.4chan.org/read/prog/1318534478

I bet 90% of you retards here haven't even looked at the output of a compiler.

Name: Anonymous 2012-07-20 22:09

Does anyone know of a good general library like Boost that uses a more C-ish approach (i.e., no massive executable bloat because loltemplates)?

Name: Anonymous 2012-07-20 22:11

>>62
Not surprised. /prog/riders are retards who can't into low level code.

Name: Anonymous 2012-07-20 22:33

>>53

THE FUCK ARE YOU DOING ARE YOU THE GRAND ARBITER OF KNOWLEDGE OR THESE ARE JUST OPINIONS ARE YOU GRADING BASED UPON CONSISTENCY WITH YOUR LIMITED KNOWLEDGE AND JUDGMENTS OF THE STATE OF THE WORLD AND PROGRAMMING LANGUAGES ONLY IMPLEM EXISTS NOW NO FUTURE NO PATH WHAT IS FIXED APPLICATION CODE APPLICABLE QUERIES SOLVENT VAPOR FIXED RESULTS UNDECIDABLE?

Name: Anonymous 2012-07-20 22:57

Lord won't you check my mercedes dubs

Name: Anonymous 2012-07-20 23:10

>>62
I remember reading that for the first time and being amazed that they didn't even pass the assembly through a basic optimizing assembler, it could get rid of what is practically dead code easily and rapidly.

Name: Anonymous 2012-07-20 23:37

>>62
>>64
you have no idea how a compiler works, inefficient machine code would be caused by bad backend optimization

>>65
take your meds

Name: Anonymous 2012-07-20 23:51

>>65
tdavis-san! :DD

Name: Anonymous 2012-07-20 23:55

>>67
I doubt an assembler would do that, as far as it knows, it might as well be a deliberate NOP to align code/data.

Name: Anonymous 2012-07-21 0:23

optimizing assembler
Doesn't even exist. Defeats the purpose.

Name: Anonymous 2012-07-21 0:38

>>71

there are a few things that you can do at that level. But assembly is difficult to work with. The program has much more structure in the earlier stages of compilation.

http://en.wikipedia.org/wiki/Peephole_optimization

Name: Anonymous 2012-07-21 0:46

>>71
yes it takes skill to write fast assembly dumbfuck, try reading Michael Abrash's "Zen of assembly language"

Name: Anonymous 2012-07-21 0:58

>>72-73
Optimization done at assembly level != an optimizing assembler, you idiots. The assembler's job is to just assemble the assembly, not to scramble the assembly I crafted with love.

Name: Anonymous 2012-07-21 1:01

>>72
Thanks for reminding me how shitty Wikipedia is

Name: Anonymous 2012-07-21 1:02

>>70
It could still eliminate "dead code", and then realign things later on with NOPs itself.

I don't understand why it would use instructions that are potentially way more expensive than a NOP just to align data so I think it's just shitty codegen but there you go.

>>71
Yes it does exist, and you're fucking retarded if it says that it "defeats the purpose". The purpose of an assembler is to assemble assembly code into opcodes, how it does it is just an implementation detail.

Name: Anonymous 2012-07-21 1:03

>>73
Perhaps you're confused. >>71-san conventionally referred to assembler as the software that assembles your assembly language code.

Name: Anonymous 2012-07-21 1:06

>>76
The purpose of an assembler is to assemble assembly code into opcodes, how it does it is just an implementation detail.
Not to be confused with assembling code into unexpected opcodes and patterns thereof for the sake of "optimization." Show me an assembler that does this.

Name: Anonymous 2012-07-21 1:21

>>78
Just run nasm -Ox or something like that, plenty assemblers offer this kind of behavior.

Name: Anonymous 2012-07-21 1:43

>>79
Not >>78.
_start: mov eax, [ebx]
        mov eax, [ebx]
        push eax
        pop eax
        push eax
        push eax
        pop eax

nasm file.s's disasm:
00000000  66678B03          mov eax,[ebx]
00000004  66678B03          mov eax,[ebx]
00000008  6650              push eax
0000000A  6658              pop eax
0000000C  6650              push eax
0000000E  6650              push eax
00000010  6658              pop eax

nasm -Ox file.s's disasm:
00000000  66678B03          mov eax,[ebx]
00000004  66678B03          mov eax,[ebx]
00000008  6650              push eax
0000000A  6658              pop eax
0000000C  6650              push eax
0000000E  6650              push eax
00000010  6658              pop eax

OMG OPTIMIZED, right?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List