From: Morris Dovey on
(oops!) G2 --> G15

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA



From: nicksanspam on
Morris Dovey <mrdovey(a)iedu.com> wrote:

><nicksanspam(a)ece.villanova.edu> wrote in message

>| I took a grad course in C and was the only one who handed in the first
>| assignment on time (the VU 1 and 2B3s were broken a lot.) It worked,
>| but the fascist prof gave me an F on that program because I used a GOTO
>| :-) C is horrible. No error checking. Practically anything you type gets
>| executed. Unreadable...

>... I've only ever written one C program that actually /needed/ a goto
>statement -

My hard-core C friends seem to think it's OK as a way for to bail out of
lots of different unrecoverable errors. When all else fails and things
can't be fixed, a lot of different programs can go to the same place.

>I had the same feeling about C compiling anything written when I
>started. It's the problem every newbie has with the language. All I
>can say is that the problem seems to go away as the programmer becomes
>more savvy...

That's encouraging. I like languages in which a variable can only be blue,
green, or yellow, and if you try to make it red, somebody tells you.

>| Hordes of 3rd graders used to write BASIC programs at Dartmouth...

They would climb out of their school buses every afternoon and take over
all the Kiewit public terminals.

>You may have just answered a question that's been nagging at me for
>decades. <g>

Oh?

>The original Dartmouth BASIC was really bare bones, though - not much
>there to screw up with.

I wasn't aware that it was a lot simpler than GWBASIC.

>... your options really are limited if you require the BASIC interpreter;
>and they really are wide open (and the bulk of your code most probably can
>be easily ported to new architectures) if you implement in C.

I use BASIC for calcs and TMY2 simulations. Readability is important,
and floating point and log and trig functions. The platform cost isn't
important for design calcs, but low cost and low power are important
for things like a smart whole house fan controller.

>If you run into difficulties I, or any of the folks on news:comp.lang.c,
>can help.

Thanks :-)

Nick

From: Joe Fischer on
On Tue, 26 Dec dold(a)04.usenet.us.com wrote:

>> the fascist prof gave me an F on that program because I used a GOTO :-)
>
>That statement deserves a smiley, because it's laughable.

The concept that there is something wrong with GOTO
is what is laughable, there direct machine instructions for the
386 family that does precisely that.

What can possibly be wrong with using a machine
instruction?

This is one of the things wrong across the board
with all concepts and technology today, outhouse rumors,
old wives tales, and gossip shape the thinking of many,
in direct opposition to facts.

GOTO is the same as JMP (unconditional), and
that is used often in machine language, along with the
conditional jumps.
They save code and processing time if used
properly, the "high level" way of calling functions uses
more instructions, more CPU time, and uses more
stack space to store the return address, which can
actually cause the program to crash in some cases.

And the same thing is happening with PHEVs,
there are writers now that are saying the auto makers
fear public objections to "having to plug in the charger",
even though the very purpose is to save money and
possibly not burn as much fossil fuel.

Joe Fischer

From: Joe Fischer on
On Tue, "Morris Dovey" <mrdovey(a)iedu.com> wrote:

>I wasn't inviting a language war - your options really are limited if
>you require the BASIC interpreter; and they really are wide open (and
>the bulk of your code most probably can be easily ported to new
>architectures) if you implement in C.

That overlooks the fact that the BASIC text file
source code is easier to use by anyone with a copy
of a BASIC interpreter, and easier to change parameters,
in the shortest possible source code, ___without___
compiling.
Compiled programs are good for certain things,
line number BASIC has it's merits, one being the
ability for a user to change it easy.

But there are BASIC compilers that don't
need the RUNxxxxx support files, although that
defeats the purpose of writing source code that
can be translated to human understanding of
the calculations.

When doing any energy calculations, it
helps to be able to work directly with the source
code and an interpreter.
And there are even people who object to
just being the slave of the programmer and
just fill in the values when prompted, but
to each his own.

Joe Fischer

From: Morris Dovey on
<nicksanspam(a)ece.villanova.edu> wrote in message
news:ems4h0$ikq(a)acadia.ece.villanova.edu...

| I use BASIC for calcs and TMY2 simulations. Readability is
important,
| and floating point and log and trig functions. The platform cost
isn't
| important for design calcs, but low cost and low power are important
| for things like a smart whole house fan controller.

Readability is more or less a matter of writing code to be readable,
regardless of language. Here's a transliteration of one of your recent
snippets:

#include <stdio.h>
#include <math.h>

int main(void)
{ double panes, sun, loss;

for (panes=1; panes<=10; panes++)
{ sun = 1000 * pow(0.9, panes);
loss = 24 * (70 - 30) / panes;
printf("%.0lf %8.4lf\n", panes, sun - loss);
}
return 0;
}

Following the Borland example, some implementations of C (for CPUs
without FPUs) include emulation code. I've written a couple of
software floating point libraries in C to do basic operations (add,
subtract, multiply, divide, square root, and sine/cosine) and they're
not exactly socket surgery.

For one-off projects, none of this probably matters very much. OTOH,
if the object is to produce large quantities and to achieve
performance objectives while using a slower uC, then the savings can
be huge.

--
Morris Dovey
DeSoto Solar
DeSoto, Iowa USA
http://www.iedu.com/DeSoto