Go Down

Topic: Every so often I am stunned by a post. (Read 4 times) previous topic - next topic

dhunt

I like the recent "minecraft server on an arduino" question. Seems like an awesome challenge! :)

AWOL

Quote
It's the effing syntax!

C is a block-structured imperative language - after Pascal, what's so hard to learn?
They are both, after all, descendents of Algol (now there I had syntax problems!)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Jantje


You know, languages that are readable!

It is not because you can write unreadable code in C(++) you should.
I know C has advertised itself as  "very short and powerful" (expressed by only using 1 letter to define the language) I consider that as one of the few mistakes W. Kernighan and Dennis M. Ritchie made . Not because they went to far but followers would write code like the one below and think it is great.
Code: [Select]
while( *outstr++ = *instr++);

Basically there is no reason to ever write unreadable code. It is generally accepted now that code is read multiple times more than it is written (some say 10 times; some say far more).
Therefore my advice is to do an effort in selecting good names and structuring the code. Consider your code as a book that others can read. Don't think you will remember your intentions 2 moths from now. Take away 2 years from now.

On the original topic
The posts that stunned me most are the ones where I think "Have you looked, I just read 5 posts about this?" or "You don't want to share your problem but you want us to fix it?"
But isn't that part of the fun in life? 8)

best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

justjed


But more often it's something that should should earn automatic, possibly life-time Tea Party membership


Of course, there's also the part about insulting people by using their political affiliation as a deprecating term.


Code: [Select]
while( *outstr++ = *instr++);


Perfectly understandable to someone who's written assembly language. Looks just like
Code: [Select]

mov (R3)+ (R4)+
bne LABEL

Well, that's if I remember Macro-11 much. Sure, it's debatable when code becomes too obfuscated, but using pointers to copy a z-byte string is pretty tame.



Sometimes, it's brilliant like Morris Dovey's unsigned division routine.


How about a link to this...?


This http://arduino.cc/forum/index.php/topic,92738.0.html ?
... it is poor civic hygiene to install technologies that could someday
facilitate a police state. -- Bruce Schneier

takao21106

#9
Mar 13, 2012, 02:35 am Last Edit: Mar 13, 2012, 03:30 am by takao21106 Reason: 1

Quote
It's the effing syntax!

C is a block-structured imperative language - after Pascal, what's so hard to learn?
They are both, after all, descendents of Algol (now there I had syntax problems!)


The original creators of C spent about ten years, hampered by small memories and slow CPUs.
In order to compile they had to shuffle a number of tapes!

Must have been a lot of effort.

Assembly is good in some matter it does not put restriction on the programmers creativity, and it does not impose structure where not much creativity exists originally.

Interestingly, using assembler myself for some years, I more and more tended to use techniques also found in C programs/executeable files (for instance I like relocation tables a lot).

So why emulate a compiler manually?

You can really use C similar to assembler but it's different, compared to learn programming by means of C language. It is clearly better in terms of maintainability and readability, some larger assembler sources that I wrote myself are a nightmare to me now after a number of years.

One professional programmer in a course session talked about introduction of IPV6, and he said the reason to introduce the extra address space mainly would be for the reason that it could become wasted  :smiley-sweat:

It is true having an operating system based on assembler it would be so much faster and efficient but than there is a wrong bit, wrong place, and the screen goes blank. And also compiled code is less a target for hacking because there is so much overhead.

It is even possible to code assembler on Windows, I tried a little, but then again looked my code, and disposed it off quietly. The disassembly even has become removed from Visual Studio, it was highly useful for me when I learned C++ but that's that, the IDE/debugger also has improved a lot.

There are some older assembler sources around on the net including the Busicom one (Intel 4004), you could take a look at it, and think for yourself what you have and what it is.

One still older source I saw is in a manual for a storage drum, some 16K words capacity, from the 1960s, I calculated it is 52 years old now.

Looking at this source, I am also stunned about computer languages evolution.
I also have PIC related web domain.

Go Up