Every so often I am stunned by a post.

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.

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

How about a link to this...?

GoForSmoke:
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...? :smiley:

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.

I hope my Posts aren't making you swing :grin:

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.

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

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!)

cyberteque:
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.

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

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.

Jantje:

while( *outstr++ = *instr++);

Perfectly understandable to someone who's written assembly language. Looks just like

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.

cr0sh:

GoForSmoke:
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 ?

AWOL:

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 :sweat_smile:

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.

while( *outstr++ = *instr++);

This only requires knowledge of operator precedence, quite simple.

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.

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

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.

GoForSmoke:

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. :wink:

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

justjed:

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.

GoForSmoke:

justjed:

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.

Thank you for your political commentary. I've been of the opinion for sometime now that all the major political parties including all their factions are pretty much only concerned with their own interests and agendas. They have all suffered from too much genetic damage due to uncontrolled incest. Their whole shtick is worn out and not even good for a laugh any longer. I will continue to root for some sport teams, but I refuse to do the same for any political parties.

So I might say you are an idiot for taking ANY political party seriously, but I won't, because you may not take any of them seriously and I have only your posts to form such an opinion, and I don't suffer idiots lightly.

Lefty

I take them all as a serious threat. It's just that one group scares me far more than the other in a fascist sort of way.

GoForSmoke:
I take them all as a serious threat. It's just that one group scares me far more than the other in a fascist sort of way.

Then you don't really understand Fascism. You also don't understand what the Tea Party was originally about. And you're far to loose with your name-calling.

“The definition of fascism is The marriage of corporation and state ”
? Benito Mussolini

We are well on the way.

while( *outstr++ = *instr++);

Basically there is no reason to ever write unreadable code [like the above]

Well, there WAS. Back when compilers were much dumber, a construct like that was probably much easier to translate into machine language than the more verbose versions of the loop. At least, on a PDP11 where the inside becomes a single instruction.

These days, we can, and should, expect the compiler to produce pretty equivalent code for equivalent functions, and write the code for clarity, rather than direct similarity with machine code. But there were "bad times" when using short variable names and leaving out comments would make your program run faster, in some languages... And by now, as several people have pointed out, this has become a semi-standard construct that programmers are supposed to recognize, no more mysterious than "PORTA |= (1<<BITPOS);" or "c = (a^2 + b^2)^0.5;"