>> When I was a gaffer, we had to carry our card decks
>> uphill both ways to the card punch!
> You had card punches? We had to cut holes into ours
> with exacto knives.
Exacto knives? We could only dream of having knives, we
had to chew the holes in ours.
Monty.
.
___________________________________________________________
Yahoo! Messenger - want a free and easy way to contact your friends online? http://uk.messenger.yahoo.com
>> for(i=0; i < n; ++i)
>> printf("%u%s", aryp[i], ","+(i >= n));
>
>Um, you're right, but yours does ;)
>
>(Can you spot the error? ;)
Yup - should be ((i+1) >= n)
I told you this was getting silly!
Cheers,
--
dave04a (at) Dave Dunfield
dunfield (dot) Firmware development services & tools: www.dunfield.com
com Collector of vintage computing equipment:
http://www.parse.com/~ddunfield/museum/index.html
>>I finally got around to replacing the batteries on my TRS-80 PC-1 and
>>noticed that the intervening years have not been kind to the LCD
>>screen. It appears that there is liquid crystal leaking out under the
>>polarizing screen, creating what looks like black smudges on the
>>display.
> I don't think there's anything you can do about them. I noticed that all
>the PC-1s that I saw were developing that problem and that was probably
>over ten years ago. Radio Shack Quality!
Both of my PC-1's have it - but they still work!
--
dave04a (at) Dave Dunfield
dunfield (dot) Firmware development services & tools: www.dunfield.com
com Collector of vintage computing equipment:
http://www.parse.com/~ddunfield/museum/index.html
>I trump thee collectively:
>
>void print_arg(int *aryp, size_t n)
>{
>
> char *t="%u,";
> int i=0;
>
> for (;(i==n-1 ? t="%u" : i<n);) printf(t, *aryp + i++);
>
> putchar('\n');
>
>}
>
>A little ugly (the compiler complains about the type mismatch in the unary
>expression) but otherwise it works without caveats (that I know of ;)
>
>I suspect someone might bum it down further...no more precious time to
>expend on this useless pursuit ;)
I'm a little confused about the definition of "trump" when used in
this case:
- You have returned to an excess of local variables, and the
extra assignment - although you have used a (more expensive)
conditional to defer it until the last iteration.
- You have returned to TWO conditionals, although you have
creatively moved them both into the for statement.
- In the last iteration of the loop you are stuffing the address
value of the constant string "%u" into the for conditional
(granted in any reasonable implementation this will be non-zero
and will evaluate to TRUE, however it seems a bit odd and not
completely necessary to the logic of the program).
- You are reading only the first element of the array, although
you are adding an increasing offset to it for each iteration of
the loop.
This really is getting silly.
So... Seen any good old computers lately?
How about them Altairs - ain't they something?
When I was a gaffer, we had to carry our card decks
uphill both ways to the card punch!
Regards,
Dave
--
dave04a (at) Dave Dunfield
dunfield (dot) Firmware development services & tools: www.dunfield.com
com Collector of vintage computing equipment:
http://www.parse.com/~ddunfield/museum/index.html
>> You could of course do something "clever" to make the
>> extra conditional harder to see like:
>>
>> for(i=0; i < n; ++i)
>> printf("%u%s", aryp[i], ","+(i >= n));
>
>This is why I really don't like C much :-) (Although I do insist on
>using it a lot of late...)
I'm guessing your not a big APL fan?
Regards,
--
dave04a (at) Dave Dunfield
dunfield (dot) Firmware development services & tools: www.dunfield.com
com Collector of vintage computing equipment:
http://www.parse.com/~ddunfield/museum/index.html
I just came across an original HP box which says HP64000 release 3203.
It contains some manuals/docs and 2 tapes. Does anyone know what this is or
what it is for ?
If anybody wants it, its available, just make me an offer of some sort.
Ow its from 1992 btw.
Stefan.
-------------------------------------------------------
http://www.oldcomputercollection.com
Various messages compined into one - quotes are not all from the
same person(s).
>Straighten up and get serious. You used twice as much printf as
>everybody else. Have you ever seen the setup for a printf call in
>assembler?
>I wonder if even the compiler can save you from this shameless bit of excess.
Unlikely - as there are two different format strings.
>... the wrong answer being to dump out each array element followed by a
>comma, then output ^H as the final step in the function ;-)
Works poorly on hardcopy devices :-)
>Real Programmers would presumably use putc exclusively in favour of the
>more computationally expensive printf...
Naw, printf() is a simple and versatile tool, and since the code is only
linked once it's usually worth it as it's handy "all over" - besides,
printf() doesn't have to be huge - here is my CSTATS output for my integer-
only printf format routine (which is a single function that does not call
ANY other functions - all tests and conversions are internal):
Characters:
in file(s) : 2263
in comments : 733
whitespace : 620
significant : 910
Lines:
in file(s) : 97
blank/comment: 23
significant : 74
Cism's:
'{'s : 13
'}'s : 13
';'s : 47
comments : 20
74 lines and 47 statements (including variable declarations) in 13 blocks.
This is an integer-only printf() formatter (real programmers don't use FP)
written in pure C which supports the following free form types:
%c (character)
%s (string)
%d (signed decimal)
%u (unsigned decimal)
%x (hexidecimal)
%o (octal)
%b (binary)
%% (single '%')
And formatting of any of the above types in the form:
%5x <= 5 character, right justify, space fill
%05x <= 5 character, right justify, zero fill
%-5x <= 5 character, left justify, space fill
%-05x <= 5 character, left justify, zero fill (kinds useless :-)
[and yes, other format widths besides 5 are supported!]
- Codesize compiled from C for the 8086 (my Micro-C) is 688 bytes.
- Code size of comparable routine hand crafted in assembly language
for my 8051 compiler library is 437 bytes (although this adds a
new %i for strings in internal memory).
- Code size for the C-FLEA (a virtual processor I developed which is
an optimized C target) is 335 bytes.
Just because winbloat leads us to expect multi-megabyte executables and
massive libraries - it duzn't has to be so!
>> void print_ary (int *aryp, int n)
>> {
>> int i;
>> for (i=0; i<n; aryp++, i++)
>> {
>> if (i>0)
>> printf (", ");
>> printf ("%u", *aryp);
>> }
>> printf ("\n");
>> }
>
>Um, if you're anal like me, you don't want to print a comma after the last
>value, so:
>
>...
> printf ("%u", *aryp);
> if (i<n) printf (", ");
Um, the original code won't print a comma after the last value.
You could of course do something "clever" to make the
extra conditional harder to see like:
for(i=0; i < n; ++i)
printf("%u%s", aryp[i], ","+(i >= n));
This is getting silly!
Regards,
--
dave04a (at) Dave Dunfield
dunfield (dot) Firmware development services & tools: www.dunfield.com
com Collector of vintage computing equipment:
http://www.parse.com/~ddunfield/museum/index.html
I finally got around to replacing the batteries on my TRS-80 PC-1 and
noticed that the intervening years have not been kind to the LCD
screen. It appears that there is liquid crystal leaking out under the
polarizing screen, creating what looks like black smudges on the
display.
I dug my less scratched up version out of storage and found the same
thing, only worse. I doubt these LCD panels are still in production.
Anyone have any ideas that might be able to alleviate the problem?
Eric
Hi Steve,
GPIB / HPIB FAQ sounds like a good idea ..
>* Bus Analyzers - IE HP59401A
If you're going to include HPIB bus analyzers in your FAQ it would be worth
looking at the National Instruments PCI-GPIB+ card. This card can be
configured as a bus analyser that captures all HPIB messages (control, data
and status) onto a controller PC with the size of the log-file limited only
by available disk space.
I've found it to be a lot more useful than the more commonly available HP
59401A analyser.
If you need any further info on this card for your FAQ then please feel free
to drop me an e-mail.
Cheers
Peter