Re: Hey, what is all this 'off topic' posting?



On Mon, 05 Sep 2005 22:01:05 -0400, keith wrote:

> On Mon, 05 Sep 2005 13:59:46 -0700, Bob Monsen wrote:
>
>> On Mon, 05 Sep 2005 12:40:58 -0400, keith wrote:
>>
>>> On Sun, 04 Sep 2005 20:17:37 +0200, Frank Bemelman wrote:
>>>
>>>> [quoted text muted]
>>>
>>> Macros are far more than (even sort of) subroutines. They can do
>>> conditional processing too. A few years back (when I was doign such
>>> things) I had a set of x86 assmebler macros that would do PL/I-like
>>> branch constructs (IF/THEN/ELSE, SELECT/WHEN in both forms, LOOP, UNTIL,
>>> etc.). Assembler macros are *much* more than (sort of) subroutines. If
>>> that's all you're using macros for, I can see why you don't much like ASM.
>>
>> It's the duckling syndrome. We always love whatever we bonded to as a
>> child.
>
> Not at all. I had all of two weeks of PL/I in college and perhaps another
> week (40 hours class) OTJ. Otherwise I've never used it. I *do* like
> PL/I language constructs though. Pascal, I was moderatley comfortable
> with. I was riased with Fortran, so Basic is trivial. ASM is comfortable
> because that's what I do; sling bits. I really don't care what the
> processor is, it's a small learning curve to be productive
> (particularly the embedded stuff). VHDL is nice because it's *NOT* 'C'. ;-)
>

A TA in college worked at IBM, and liked PL/1. Another cool language which
seems to have no following these days is ada, probably because they never
got out the secure compilers. It had threading support back in 83, which
is when I was in school. I learned ASM, then fortran, then pascal, then C.
Since everybody uses C, that's what I've been using since I got out of
school. However, I've written forth systems, lisp systems, and a prolog
system. I do have a bit of experience with other languages. I just like C
for some reason (quack quack!).

>> I like C because it's what I
'grew up' with. I've done lots of asm
>> coding, but it is always painful when I have to hack out the loop
>> control structures yet again using compare and branch instructions (or
>> write the macros using some arcane assembler to do that on a new
>> architecture), or explicitly allocate and reuse local variables, or
>> remember which status bits get whacked by which instructions, or try to
>> remember the calling registers or stack allocation for a called
>> routine.
>
> You're not structured enough. It's been years since I had problems with
> asm stuff, yet 'C' will allow even the most experienced programmer to
> shoot himself with pointers without knowing better. I can't tell you
> the number of times we have hard crashes going form one OS (or compiler)
> version to another because different assumptions are made WRT pointers.
> Crappy programming, agreed. I don't see experienced ASM programmers
> making the same stupid mistakes. They *know* what a pointer is and to
> treat it with respect.
>

The reason nobody has problems porting ASM is that one never does it, at
least beteen architectures... at least C will give it a try. Using lint or
C++ (if you can stand the overhead) gives you enough checking to prevent
weird pointer fiascoes, unless you are coding like the guys who wrote the
original yacc; they were porting from fortran, and used arrays of
integers to hold pointers. Ouch!

The reason Wirth designed pascal was to protect people from pointer and
allocation problems. The first thing people did when they got it was to
ask how to do typedefs...

>
>> C does all this for you, at a small price in efficiency, but doesn't
>> get in your way like many other HLLs. I think the level of abstraction
>> is just right for most software that touches hardware. That is probably
>> why most OS, driver, and embedded software is written in it, and has
>> been for 25 years. If you need more speed or more space, there are hard
>> core optimization options, and you can always profile and optimize by
>> hand in assembler.
>
> I dissagree. Most work that touches hardware is done in 'C' because
> programmers are too dumbed down. ;-)
>

Well, tell that to Tony Li or Stallman.

Here is a story for you. I worked, out of college, at BBN on the east
coast. They had written the original "IMP" software for the arpanet,
including those horrible state-vector (is this right? It's been years)
optimized routing algorithms, all in assembler. The listing was at least 4
inches thick, not counting covers...

The code was designed to run on a Honeywell 316 processor. When Honeywell
decided to stop producing them, BBN found it cheaper to build another
machine and emulate the 316 instruction set than to rewrite the code. They
ran the original nodes of the Internet on that code...

As a contrast, at cisco, there were literally 30 hardware platforms,
including different machine architectures from tiny 2 port boxes to huge
redundant system, compiling out of the same source base. It was all C
(99.9%).

It's not too surprising why BBN in longer exists (bought by GTE some time
ago, now run some kind of isp), and cisco (and spinoffs) has the entire
Internet infrastructure market.

>> Yet another good thing
about C is that it's pretty standard. Nearly
>> everybody can read it after a few minutes instruction (unless you've
>> macroized it to look like cobol) Assembler with macros tends to look
>> like a private language, and intuiting higher level structures can be
>> daunting.
>
> Hmm, tell that to IBM. MVS is written in PL/S (or PL/AS), which isn't
> much more than a macro language on top of 370 assembler. If the macros
> are written correctly, they work just fine.

I agree, they work fine. I actually don't mind assembler if it's
commented well, I just find it annoying after the ease of using C.

>
>> C was designed to be a portable assembly language,
>
> I'd like to see you argue that point over on comp.sci. They chew people
> up with that attitude (though personally I don't disagree, much).
>

I think this was said by Ken Thompson, although I can't find a reference,
and can't remember where I heard it.

>> and, in my opinion,
>> does a great job at that task, and many others. Quick to write, often
>> portable, easy to read, handles annoying details that can be the source
>> of bugs, but lets you whack away at hardware without trying to protect
>> you from yourself. Flexible, malleable, can be used to write drivers,
>> operating systems, or AI. It's a good language.
>
> It sucks as an embedded language. It might be OK (with the ++ crap
> added on top) for UI stuff, but it is crap as an embedded language.

I disagree, but you may have a story that proves your case. I'd like to
hear it. I've written what I consider to be embedded systems (systems with
no OS, no OS API, direct hardware access, no BSP) many times in C, and it
never gets in the way or screws up too badly, even in weird memory caching
situations, or on screwy architectures like the PIC or Z8 Encore. It
simplifies my life, but then again, it's just a tool, not a religion. Use
it or not, depending on if it helps you do your job.

--
Regards,
Bob Monsen

If a little knowledge is dangerous, where is the man who has
so much as to be out of danger?
Thomas Henry Huxley, 1877


.



Relevant Pages

  • Re: Help...
    ... An Assembler is a Programming Tool that translates ... HLA does this. ... Macros and Equates substitutions features. ... difference between a language and the implementation of a language. ...
    (alt.lang.asm)
  • Re: HLA Stdlib v2.2 is now available.
    ... a language and an implementation of a language, ... it from being an assembler. ... You argue that the fact that the HLA ... the "user" can write their own macros and this makes all the ...
    (alt.lang.asm)
  • Re: To Beth
    ... Allready, I write asm, in many many cases, when using the ... I disagree that development time is faster writing in assembler, ... vanishes if you have a good macro language available. ... Not commenting code in my opinion is the worst habit ever. ...
    (alt.lang.asm)
  • Re: a turbo assembly language
    ... > With this You will go more fast of a C (or whatever language you want) ... > programmer because debugging assembly program is easier. ... * "Writing Asm would be more time consuming than HLL". ... RosAsm Assembler Syntax, at all. ...
    (alt.lang.asm)
  • Re: Hey, what is all this off topic posting?
    ... >> that's all you're using macros for, I can see why you don't much like ASM. ... PL/I language constructs though. ... > write the macros using some arcane assembler to do that on a new ...
    (sci.electronics.design)