student project

to newbies.

own style.

does.

used

real,

Walk-throughs are rare, but in a walk-through, the author is explaining the program to others. What would be better is a read-through, of the source code, with the author not present and no personal memory involved. That's all that will be available 5 years later, when all those programmers have forgotten this project, or maybe moved on entirely.

A variable name can't tell you *why* something is being done, which is what comments should do. And variables should be commented, in detail, when they are declared.

John

Reply to
John Larkin
Loading thread data ...

^ ^ ^ ^ ^ ^ As in, freely formatted code?

The nice thing about C^Hstandards is, there are so many of them...

Now I, on the other hand, wrote a quite excellent program just the other night, in a few hours, for which these margins are too narrow to fit. So download it here:

formatting link

QBASIC automatically capitalizes all keywords. Variables are traditionally either ambiguous (indexes of i, j, etc., but that's common enough anywhere) or NamedLikeThis. Indentation and sectioning is very easy to do. And comments are just a keystroke away ("'"), not even a double-slash, or that awful slash star star slash monstrosity.

Between the comments (with diagrams, no less) and flow of the algorithm, it's trivially apparent what's going on here.

I hope you don't format your code like you do your schematics. Dark, sloppy and poorly commented.

Err..

So, it's not C? It's...

Dutch C and English C and German C and some of them use braces on the side like this { stuff }

and some of them use braces up here { stuff } andsomeofthempackalltheoperatorswithnospacesanywhere

and some

use lots

of white space

I must say, it doesn't sound like *one* language to me.

Not even to mention C++. Yeech.

Tim

--
Deep Friar: a very philosophical monk.
Website: http://webpages.charter.net/dawill/tmoranwms
Reply to
Tim Williams

On a sunny day (Wed, 17 Nov 2010 20:26:13 -0600) it happened "Tim Williams" wrote in :

Yes, drawing pictures on the screen. The difference bewteen

if(it_sucks(today)){ system("killall -KILL rxvt"); }

or

if( it_sucks(today) ) { system("killall -KILL rxvt"); }

Actually C has been rather constant the last few years. It does help, for a C newbie like J.L, to read the original 'The C programming Language' by K&R. I still have it on the shelf..

Yes, but that is BASIC, I like the printf() and scanf() formatting option far to much to even ever consider BASIC again. Global vars ?

My schematics, the pictures I post of those, are my working pieces of paper, I solder thing together on those, as all the resin spots clearly show. They are exquisite as between the lines they carry the deeper understanding that lacks in the drawing program generated collection of crap lines that you so much seem to like. For those who have problems understanding my schematics, means they have limited understanding of how processes in my mind materialise, have not learned to read between the lines, and are doomed to copying blurbs from electronic publications that are full of errors and design errors too. I am sorry for you, but, maybe over time you will learn.

So how many languages do you speak and can write other then unglish?

C++ is not a language, it is a speech disability.

:-)

Reply to
Jan Panteltje

On a sunny day (Wed, 17 Nov 2010 15:38:54 -0800) it happened John Larkin wrote in :

newbies.

style.

does.

real,

Yes, C is as close to a real language as things will ever get :-) Perfect:-)

Reply to
Jan Panteltje

newbies.

style.

does.

real,

Serious stuff, things that your life depends on, are coded in ADA.

John

Reply to
John Larkin

Language' by K&R.

I have it, I read it when it was new. My reaction, then and now, is that it's a language ideal for use by geniuses for very quickly hacking clever tricky stuff, and it's going to kill people.

consider BASIC again.

PRINT USING makes printf() look barbaric, which it is. BASIC is just not well suited to deep embedded systems.

John

Reply to
John Larkin

Jan Panteltje expounded in news:ic1mtb$m6f$ snipped-for-privacy@news.albasani.net:

..

This is of course a "software religious" thing. I've been doing C for most of my career, and certainly it has it's place in this world.

But since the advent of GNAT (free Ada compiler) in the '90s, I've jumped ship to Ada for my open sourced projects. I even use Ada on my AVR projects now (see:

formatting link

Ada is an order of magnitude more beautiful than C and is an order of magnitude better for development of large projects.

In these days of multi-processing, Ada is much better at managing thread (task) related processing because it has language features for managing tasks. In other languages, the programmer must carefully articulate calls to thread primitives. And this is the worst place to make an error, usually resulting in a very unhappy and lengthy debugging phase of intermittant errors.

Most importantly, Ada doesn't need reformatting in order to be read. It can be pre-processed (using gnatprep), but this is non- standard. The Ada standard language doesn't hide behind a macro expansion like cpp. This also aids in readbility.

But Ada is sufficiently different as a high level language, that it takes discipline and experience to use if effectively. Many ppl are unwilling to go that extra mile. So C/C++ remains popular on embedded platforms.

Warren

Reply to
Warren

"John Larkin" wrote in message news: snipped-for-privacy@4ax.com...

I know at least one person who uses PIC Basic. I tease him relentlessly.

Tim

--
Deep Friar: a very philosophical monk.
Website: http://webpages.charter.net/dawill/tmoranwms
Reply to
Tim Williams

John Larkin expounded in news: snipped-for-privacy@4ax.com:

*Ahem*, actually, it is Ada.

ADA is for the American Disabilities Association, American Dental Association among others.

Sorry - getting this wrong is an Ada enthusiasts' pet peeve. ;-)

Warren

Reply to
Warren
[...]

that lacks

seem to like.

limited understanding of

IIRC the main "problem" with them was just the images were very low contrast and so hard to read on-screen. Nevertheless they were nice to see, thanks for posting them (I remember using gimp to enhance them a bit).

If you could just press a bit harder with your pencil, or photograph in brighter light, that might help! :)

[...]
--

John Devereux
Reply to
John Devereux

In C, those formatting styles aren't part of the language spec, so understandably different people have chosen different one.

There are "pretty printers" that can modify the style from one type to another, to a certain extent. Not perfect -- kinda like machine translation of spoken languages -- but some people like it.

Personally I don't really worry about how other people style their code so long as it works; I can generally read any of them. If I'm forced to start having to debug/re-write it, though, then it'll start slowly morphing into *my own* style... :-)

Sure it is -- the compiler is just as happy with any of those styles!

Some languages do care somewhat more about formatting... FORTRAN and Python come to mind...

C++ is actually a pretty clean extension to C given what Stroustrup and friends set out to accomplish. Go look at Matlab if you want to see a somewhat uglier (but still rather impressive, given what they had to work with) implemention of objective-oriented paradigms on top of an existing procedural-type language!

---Joel

Reply to
Joel Koltner

It's just another example of a "high priest" culture. That sort of thing has been going on since before the ancient Egyptians.

It wouldn't surprise me to be told that initiates had to roll up one pants leg and put on a blindfold ;-)

--
"For a successful technology, reality must take precedence 
over public relations, for nature cannot be fooled."
                                       (Richard Feynman)
Reply to
Fred Abse

Please don't mention it.

Ever.

-- "For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." (Richard Feynman)

Reply to
Fred Abse

What does beauty have to do with function?

-- "For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." (Richard Feynman)

Reply to
Fred Abse

Well, Ada enthusiasts are paid to be rigid.

John

Reply to
John Larkin

There's nothing wrong with that when it works. But most of these Basics are interpreters, which will be pig-slow (especially on a PIC!) so limited in applications. And interpreters discourage commenting. A good embedded program should have a lot more comments than code.

There are situations where PowerBasic running under romdos or some such could do a perfectly good embedded system, but it would have to run on an x86 board of some sort.

John

Reply to
John Larkin

Remember the Boy Scouts "Order of Siam" at your first camp out:

Oh Wha Tay Gu Siam ;-) ...Jim Thompson

-- | James E.Thompson, CTO | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona 85048 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 |

I'll have you know that I have never once referred to anyone here as being a member of the ignorant, hateful, ugly, mooching class.

I have always been kind, referring to them by their own chosen name... Democrats O:-)

Reply to
Jim Thompson

Face it: most programmers are somewhere out on the autism spectrum. So they love puzzles and don't have the empathy to imagine someone else trying to read their code. That's why C programmers tend to not comment, and why they can get A's on "computer science" class exercizes where they don't comment at all, not a single line.

John

Reply to
John Larkin

Sanskrit?

-- "For a successful technology, reality must take precedence over public relations, for nature cannot be fooled." (Richard Feynman)

Reply to
Fred Abse

FORTRAN format statement is *much* nicer. Specify the format once (usually at the beginning of the program, give it a numeric label, then it's just:

output (device#, label#) each time. No need to continually respecify.

FORTRAN isn't suited to deep embedded systems, either. Sad.

--
"For a successful technology, reality must take precedence 
over public relations, for nature cannot be fooled."
                                       (Richard Feynman)
Reply to
Fred Abse

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.