Go Down

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

GoForSmoke

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

But more often it's something that should should earn automatic, possibly life-time Tea Party membership and I can't think of anything like an appropriate, helpful, reply. I could say more but just thinking about it... no, uh-uh, it's just too much and not in a good way at all.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

cr0sh


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


How about a link to this...?


But more often it's something that should should earn automatic, possibly life-time Tea Party membership and I can't think of anything like an appropriate, helpful, reply. I could say more but just thinking about it... no, uh-uh, it's just too much and not in a good way at all.


...and one here, too - we could all use a good laugh (or cry), I suppose...? :D
I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.

GoForSmoke

I dunno where Morris' thread is now and I don't want to put names on the others. How many people do you see who can send and receive C string arrays who can't figure out WTH a char array actually is?  Of course that's the time they get taught to use C++ String objects by educated folk and once again I am even more amazed.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

NI$HANT

I hope my Posts aren't making you swing  :smiley-mr-green:
"Real Men can Accomplish  Anything"

- skype : nishants5  

ਫ਼ਤੇਹ ਕਰੁਂ!

cyberteque

Hate to break it to you man, but...

It's the effing syntax!

Arduino is my first "C" like language, I normally use assembler, Forth, Python, Pascal or Pascal like languages.

You know, languages that are readable!

I run Debian, not Ubuntu, since Woody or Potato, can't remember which came first, I was amazed at how many languages came with the 3 and then the 7 CD install.
Stuff I had only read about, like Chill, Ada, Oberon, Modula.

How many of my posts here have started with,
"Can I do this in Arduino or do I have to go to assembler"?

One of the problems is the basic information is pretty damn basic.
Since I bought "Programming Interactivity", "Making Things Talk", "Building Wireless Sensor Networks" things have gotten a bit less confusing.

So go on, be smug, but it just makes you look like an ass.

8)

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

#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.

pYro_65

#10
Mar 13, 2012, 02:49 am Last Edit: Mar 13, 2012, 03:01 am by pYro_65 Reason: 1
Code: [Select]
while( *outstr++ = *instr++);

This only requires knowledge of operator precedence, quite simple.

Code: [Select]
i+++j;

Try this one.

These boards are the place for silly mistakes and learning, and its a lot easier to post a stupid question here and have it answered quickly than spend hours scouring for a dead end, that being said, it also sucks having to explain that the IDE uses C++ once a day or more.

Code: [Select]

babble is a translator from a pseudo-assembly language into a
      subset of C suitable for execution on Charles Babbage's
      Analytical Engine.  Or rather, the #defines in babble are that
      translator.  The rest of babble is a babble program.


http://www.cise.ufl.edu/~manuel/obfuscate/babble.hint
I also have PIC related web domain.

GoForSmoke

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

I'm sorry but if this is an example of hard to read let alone unreadable then you've got a lot of learning to go yet.
Of course if you have the library included then memset() might look easier to read but not actually be better.

You don't have to be fantastic at C to code in C but when you come to an expression that confuses you, treat is as an opportunity to learn. Worst case, it's buggy in fewer lines than usual.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

retrolefty


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

I'm sorry but if this is an example of hard to read let alone unreadable then you've got a lot of learning to go yet.
Of course if you have the library included then memset() might look easier to read but not actually be better.

You don't have to be fantastic at C to code in C but when you come to an expression that confuses you, treat is as an opportunity to learn. Worst case, it's buggy in fewer lines than usual.


I can sure relate to that. I have several time become very stuck trying to make a series of statement do what I want and not be able to tell why it's not working the way I expect. At those time I sometime just backup and rewrite it in lots of very primitive C statements, trying to emulate how I think it should work. That usually sets me straight to whether I just don't understand the more complex statements or the flaw is in my thinking on how the problem needs to be solved. That probably doesn't make a lot of sense, but I've found it useful none the less.  ;)

With C it seems I can move upward towards more complexity or move downward to more primitive methods, whatever seems to suit the problem and state of mind of this poor programmer. Of course my favorite programming language is solder.

Lefty

GoForSmoke



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.


You're not born with a political affiliation. It's your choice.

I've seen the Tea Party leaders speak including interviews and read what they have said. Only idiots would take any of that pack seriously. The same idiots who take opinion over science as a matter of common sense.

If they weren't idiots then there would be different candidates and the GOP wouldn't be so worried.
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

Go Up