Making Fatal Hidden Assumptions

A

Alf P. Steinbach

* Al Balmer:
The reference you give doesn't say that.

I'm sorry for not being clear:

Wikipedia is not a reference to back up some statement, and in fact it's
not a reference of any sort (but let's not go off discussing /that/
again, just trust me: it isn't).

I gave the link as an opportunity for Richard, and now you, to learn
some very basic things, and that's why I wrote "e.g.", which means, "for
example". Also see the links provided elsethread.
 
R

RSoIsCaIrLiIoA

RSoIsCaIrLiIoA wrote:
... snip ...

You temporarily got off my list due to some changes in newsreader
software. At the first sign of more ridiculous obfuscating macros
you go right back on it. Meanwhile I am not likely to pay much
attention to anything you say.

are you in US too?
 
R

RSoIsCaIrLiIoA

According to my newsreader, your first post was at 4:34 am, and your
second at 5:30 am. What were you expecting? Do you have this group
confused with a chat room?

pheraps in your time, my second post seems to me 12:34am, here in
Italy; i think you are in US. near Boston?
 
P

Paul Keinanen

I don't think this is what happens. Instead I think DX will wrap to FFFF,
and ES will remain unchanged.

If p=s-1 would only cause decrementing of DX (and not effecting ES)
and thus wrapping to FFFF, then what would p++ do ? It would be
logical to assume that only DX would be affected and incremented by 1,
causing wrapping DX back to 0000 and hence ES:DX would have the same
representation as the original s and p == s would be true.

Paul
 
A

Al Balmer

* Al Balmer:

I'm sorry for not being clear:

Wikipedia is not a reference to back up some statement, and in fact it's
not a reference of any sort (but let's not go off discussing /that/
again, just trust me: it isn't).

I gave the link as an opportunity for Richard, and now you, to learn
some very basic things,
<sarcasm>
Why, thank you!
</sarcasm>
There aren't any "basic things" in that article which I haven't
already learned, most of them decades ago. I'm sure the same is true
for Richard and Keith. OTOH, the article could have been a learning
experience for you, but apparently it was not.

(Talk about making assumptions!)
and that's why I wrote "e.g.", which means, "for
example". Also see the links provided elsethread.

I think it's time to drag out an acronym I haven't used for a while -
ABIYP.
 
E

Ed Prochak

Keith said:
Ed Prochak said:
Keith said:
[...]
C is an assembler because

I should have phrased this: C is LIKE an assembler.

And a raven is like a writing desk.
<http://www.straightdope.com/classics/a5_266.html>

"C is an assembler" and "C is like an assembler" are two *very*
different statements. The latter is obviously true, given a
sufficiently loose interpretation of "like".

Well my original statement was that C was a glorified assembler.
We don't need to stretch the meaning of like to the breaking point.

The C standard doesn't distinguish between different kinds of
diagnostics, and it doesn't require any program to be rejected by the
compiler (unless it has a "#error" directive).

The point is I can assign an integer value to a pointer. The warning
is a nice reminder, but that is all it is. Assemblers allow integers
to be used as pointers. Many HLL's never allow this. Can you suggest
another HLL that allows simple assignment of integer to pointer? (I
recall PL/M, a version of PL/1 for micros from INTEL. It specifically
for embedded programming so this was a required feature.)


... This allows for
language extensions; an implementation is free to interpret an
otherwise illegal construct as it likes, as long as it produces some
kind of diagnostic in conforming mode. It also doesn't require the
diagnostic to have any particular form, or to be clearly associated
with the point at which the error occurred. (Those are
quality-of-implementation issues.)
Irrelevant

This looseness of requirements for diagnostics isn't a point of
similarity between C and assemblers; on the contrary, in every
assembler I've seen, misspelling the name of an opcode or using
incorrect punctuation for an addressing mode results in an immediate
error message and failure of the assembler.

You are missing my point. It has nothing to do with whether C generates
a diagnostic. And I'll happily accept the cast to be rid of it. Point
is I can manipulate memory pointers in C very easily, nearly as easily
as I can in assembler.
C provides certain operations on certain types. Pointer arithmetic
happens to be something that can be done in most or all assemblers and
in C, but C places restrictions on pointer arithmetic that you won't
find in any assembler. For example, you can subtract one pointer from
another, but only if they're pointers to the same type; in a typical
assembler, pointer values don't even have types. Pointer arithmetic
is allowed only within the bounds of a single object (though
violations of this needn't be diagnosed; they cause undefined
behavior); pointer arithmetic in an assembler gives you whatever
result makes sense given the underlying address representation.

An assembly programmer has to take on more responsibility. C provides
some tools to help. In fact, the casting helps to a small degree.
consider writing memcpy() in assembler, C, or other HLL. It is very
easy for Assembler and C. In C it may lead to code that has hidden
assumptions (the topic here) but the code will have a look very much
like assembler. In some HLLs it might not be possible to write a
generic memory copy routine.

Let me put it this way. If you are implementing memcpy(), the very
fastest, most optimized version might be pure assembler. Next would be
a version in C customized for the target platform with close to 100% of
the performance of the assembler version. The C version will be easier
to maintain than the pure assembler, but to get it that close requires
the programmer to think of the consequences of certain programming
constructs. Then you'll get a version in some other HLL which might
run well, but will be measureably below the performance of the C and
assembler versions.
... C
says nothing about how pointers are represented, and arithmetic on
pointers is not defined in terms of ordinary integer arithmetic; in an
assembler, the representation of a pointer is exposed, and you'd
probably use the ordinary integer opertations to perform pointer
arithmetic.

Yes in C I need to consider the significance of pointer types. But this
is analogous to assembler opcode options.
MOVB -- move a byte
MOVW -- move a word
MOVL -- move a longword
What about it? A conforming C implementation on such a machine must
have CHAR_BIT>=8, INT_MAX>=32768, LONG_MAX>=2147483647, and so forth.
The compiler may have to do some extra work to implement this. (You
could certainly provide a non-conforming C implementation that
provides a 6-bit type called "int"; the C standard obviously places no
constraints on non-conforming implementations. I'd recommend calling
the resulting language something other than C, to avoid confusion.)

Actually I'd assign type short to that integer. Good point though. You
made me see I picked the wrong argument. Back to the machine with 9bit
CHAR. In C the MAX_INT is dependent on the underlying processor and is
allowed ro range up to what the hardware can handle, so instead of
32768, you can go up to 131071 Other HLLs do not let that happen. the
max int in PASCAL is 32767, even on that same machine. A High level
language was supposed to get us away from thinking about the underlying
hardware wasn't it?
I'm not familiar with PL/I.

Okay, I found a web page off the PL/I faq page. here's a comment about
PL/I' independence from the hardware that speaks directly about
dayatypes:
<start quote>
PL/I defines its data types very precisely without regard for any
hardware. For example, an "integer" is defined as having a mode of REAL
or COMPLEX, base of BINARY or DECIMAL, along with the precision that
you require. Therefore, FIXED BINARY(12) declares a binary integer of
12 data bits, whereas FIXED DECIMAL(3) declares a decimal integer of 3
decimal digits. You get precisely what you ask for. The implementers
deliver even if the machine has no support for such data type or
precision.
<end quote>

So I had the syntax wrong (It's been a LONG time since I did PL/I), but
the point is
the value range is independent of the underlying hardware. In C this is
true for the low end. That 6bit byte machine would require extra code
from the C compiler to implement 8bit char types. but on a 9bit byte
machine C happily lets the programmer get access to that ninth bit, not
so in PL/I.

PL/I seems to me better than C in that it reduces the hidden
assumptions. So if you need 12bit integers, you get exactly that with
an exception generated when you hit the limit, no matter what the
underlying hardware can handle.
Ada (not ADA) has a predefined type called Integer. It can have other
predefined integer types such as Short_Integer, Long_Integer,
Long_Long_Integer, and so forth. There are specific requirements on
the ranges of these types, quite similar to C's requirements for int,
short, long, etc. There's also a syntax for declaring a user-defined
type with a specified range:
type Integer_32 is range -2**31 .. 2**31-1;
This type will be implemented as one of the predefined integer types,
selected by the compiler to cover the requested range.

Ada (yes you're right on the letter case) is similar to C. One reason
is that Ada is supposed to be for embedded systems, so it needs the
flexibility of open-ended data ranges. But it also does a LOT more type
checking than C. I only looked at it years ago, never written any real
code in Ada.
C99 has something similar, but not as elaborate: a set of typedefs in
<stdint.h> such as int32_t, intleast32_t, and so forth. Each of these
is implemented as one of the predefined integer types.

But in Ada you could declare
type Integer_24 is range -2**23 .. 2**23-1;
I don't expect stdint.h has those defined.
You can get just as "close to the metal" in Ada as you can in C.

Yes, Ada was a poor choice here. It's too close to C in its feature
set.
Or,
in both languages, you can write portable code that will work properly
regardless of the underlying hardware, as long as there's a conforming
implementation.

TRUE.
But portability alone doesn't free C from the feel of assembler.
16bit 8086 assembler code still worked essentially unchanged on the 386
processor.

.. C is lower-level than Ada, so it's there's a greater
bias in C to relatively low-level constructs and system dependencies,
but it's only a matter of degree.

yes, as I said in another post, it is a question of degree..
In this sense, C and Ada are far
more similar to each other than either is to any assembler I've ever
seen.

I can understand that view, but on the Assembler to HLL scale I still
put C closer to assembler. Ada does a lot more for you than C does,
AFAIK.
[...]
a big characteristic of assembler is that it is a simple language.
C is also a very simple language. Other HLLs are simple too, but the
simplicity combined with other characteristics suggest to me an
assembler feel to the language.

If you're just saying there's an "assembler feel", I won't argue with
you -- except to say that, with the right mindset, you can write
portable code in C without thinking much about the underlying
hardware.

I never said you couldn't. I like C. I have been using it in various
projects since the early 80's. It is a great language. I guess I'm just
saying you can write better C code knowing its assembler side. Doing
that will help keep you aware of some of these gotchas we've been
discussing.
[...]
No I was talking about the original motivation for the design of the
language. It was designed to exploit the register increment on DEC
processors. in the right context, (e.g. y=x++;) the increment doesn't
even become a separate instruction, as I mentioned in another post.

The PDP-11 has predecrement and postincrement modes; it doesn't have
preincrement or postdecrement. And yet C provides all 4 combinations,
with no implied preference for the ones that happen to be
implementable as PDP-11 addressing modes. In any case, C's ancestry
goes back to the PDP-7, and to earlier languages (B and BCPL) that
predate the PDP-11.
I remembered UNIX started on earlir model, but I thought it was a
PDP-8. I don't recall a PDP-7. But I thought C came after the initial
versions of UNIX.

I'll double check my PDP-11 manual about the increment modes. I would
swear they were both. available.
[...]
I know that it is just a suggestion. The point is Why was it included
in the language at all? Initially it gave the programmer more control.

Sure, but giving the programmer more control is hardly synonymous with
assembly language.

If you approach C with an Assembler proing mindset, you can exploint
certain features to your advantage on targetted code. Being aware of
that aspect of C can help you avoid some of those things inwriting
portable C code.
Sure, it's a low-level feature.

No, someone with only a HLL view of coding would look at that
restriction and say
"what the %^&*! Why doesn't this work?"
But someone with assembly experience would understand it immediately.
That seems like a reasonable scale (I might put Forth somewhere below
C). But you don't indicate the relative distances between the levels.
C is certainly closer to assembler than Pascal is, but I'd say that C
and Pascal are much closer to each other than either is to assembler.

That's it. We just differ on the scale.

I don't have a stron sense of the distances. I guess I would put C
about equidistant from both assembler and PASCAL. Hm, maybe someday I
will have to come up with a scale for this)
FORTH is a good example too. To me FORTH is more like a VM language.
But I haven't done any programming in it, so I left it out.
You can write system-specific non-portable code in any language. In
assembler, you can *only* write system-specific non-portable code. In
C and everything above it, it's possible to write portable code that
will behave as specified on any system with a conforming
implementation, and a conforming implementation is possible on a very
wide variety of hardware. Based on that distinction, there's a
sizable gap between assembler and C.

And when you HAVE to write non-portable code, C is a better choice
than PASCAL or other HLLs (except maybe Ada).


Great discussion. Thanks for the informative replies.
Ed.
 
A

Al Balmer

pheraps in your time, my second post seems to me 12:34am, here in
Italy; i think you are in US. near Boston?

Bad guess. Anyway, local time doesn't affect the length of time
between the messages.

(Hint - a glance at my sig would have provided a clue as to my
whereabouts.)
 
A

Alf P. Steinbach

* Al Balmer:
>
<sarcasm>

No, sarcasm is not called for or appropriate in this context.

Why, thank you!

Yes, you should thank me. But you do it like pointing at a very nice
car, then saying, "Hey, I'm being sarcastic! That's a car! End
sarcasm!". And in case you failed to understand that example, although
debating technique is probably off-topic in this group: sarcasm that
needs to be marked as such, is not a good way to win rhetorical points.
</sarcasm>


There aren't any "basic things" in that article which I haven't
already learned, most of them decades ago.

Didn't seem that way a message or so ago; then you presented the view of
a complete ignoramus, and -- now you did it again.

I'm sure the same is true for Richard and Keith.
>
OTOH, the article could have been a learning
experience for you, but apparently it was not.

(Talk about making assumptions!)

What strikes me about the quotes passage above is... Well... The last
paragraph, for example. LOL! ROTFF!
 
D

Default User

Al said:
According to my newsreader, your first post was at 4:34 am, and your
second at 5:30 am. What were you expecting? Do you have this group
confused with a chat room?

However, it's true that many of us have him/her/it plonked, for
previous trolling.



Brian
 
A

Andrew Reilly

More easily answered if the original statement had been preserved
in context. However in this case if the ES segment has range
limits, a segment fault will be triggered. Due to the happy
looseness of the term "undefined behavior" no specific action is
needed, which is what enables the loosing of nasal demons or
launching of missiles.

Nah. Seg faults only happen on access, in that situation. The value of
DX can't matter: it isn't part of the "pointer" until an access happens.

It looks as though the AS/400 is the only machine that that particular
restriction in the standard is there to support. Yay.

Cheers,
 
A

Al Balmer

* Al Balmer:

No, sarcasm is not called for or appropriate in this context.
My call, not yours.


Yes, you should thank me. But you do it like pointing at a very nice
car, then saying, "Hey, I'm being sarcastic! That's a car! End
sarcasm!". And in case you failed to understand that example, although
debating technique is probably off-topic in this group: sarcasm that
needs to be marked as such, is not a good way to win rhetorical points.

Depends on the audience. With some, one must be explicit.
Didn't seem that way a message or so ago; then you presented the view of
a complete ignoramus, and -- now you did it again.

How so? By stating a fact? One that contradicts your characterization
of everyone who disagrees with you?
What strikes me about the quotes passage above is... Well... The last
paragraph, for example. LOL! ROTFF!

So you did catch it. Not necessarily unintelligent, just a (what's
that word? Oh, yes ...) ignoramus.

I should have quit when you first resorted to insulting those who
disagree with you. Bye, now.
 
A

Alf P. Steinbach

* Al Balmer:
Depends on the audience. With some, one must be explicit.

How so? By stating a fact?

That's stretching a bit beyond the breaking point: you have yet to state
/any/ relevant fact in responses to my postings.

In your first posting responding to my posting, you stated:

they're talking about you, not the rest of the world

which is insulting, and then

Remember that the moon is sometimes said to be made of green cheese.

which is even more insulting.

Not to mention that the logic chain that those sentences were part of,
was built on an incorrect premise, which I think you knew, seeing as you
now resort to outright lying (below).

One that contradicts your characterization
of everyone who disagrees with you?

Note, I have so far responded to your calculated insults in a restrained
manner, and I will continue to restrain myself.

I have not characterized others, for the simple reason that of the three
or four or so people responding to my posting, only you tried to win
rhetorical points by using personal insults.

In short, that bit about me characterizing everyone who disagrees with
me, when I've only characterized you (and rightly so), that's untrue,
and that means you're now lying to try to resque yourself.

But you cannot resque yourself from that.

For anyone can sort messages on date+time and see that your comment is a
plain and simple lie, even with the most Al-friendly interpretation.

So you did catch it. Not necessarily unintelligent, just a (what's
that word? Oh, yes ...) ignoramus.

Yep, you're stupid.

I should have quit when you first resorted to insulting those who
disagree with you. Bye, now.

My only quibble there is with you: you started off being insulting and
off-topic. Be careful what you ask. You sometimes get what you ask for.
 
K

Keith Thompson

Ed Prochak said:
Keith said:
Ed Prochak said:
Keith Thompson wrote:
[...]
C is an assembler because

I should have phrased this: C is LIKE an assembler.

And a raven is like a writing desk.
<http://www.straightdope.com/classics/a5_266.html>

"C is an assembler" and "C is like an assembler" are two *very*
different statements. The latter is obviously true, given a
sufficiently loose interpretation of "like".

Well my original statement was that C was a glorified assembler.
We don't need to stretch the meaning of like to the breaking point.

And my assertion is that C is not an assembler, glorified or
otherwise. I doubt that we're going to come to an agreement on that
point.

[...]
The point is I can assign an integer value to a pointer. The warning
is a nice reminder, but that is all it is. Assemblers allow integers
to be used as pointers. Many HLL's never allow this. Can you suggest
another HLL that allows simple assignment of integer to pointer? (I
recall PL/M, a version of PL/1 for micros from INTEL. It specifically
for embedded programming so this was a required feature.)

C (as defined by the current standards) does not allow simple
assignment of an integer to a pointer. It specifically states that
doing so is a constraint violation. It's just as strongly prohibited
as assigning a structure to a floating-point object, or using "<" to
compare a union and a pointer.

The only thing that a compiler is actually required to reject is a
translation unit containing a "#error" directive.

The fact that some compilers choose to deal with this particular
constraint violation by issuing a warning and accepting the
translation unit is an attribute of those compilers, not of the
language.

C does allow conversion between pointers and integers, and that's a
relatively low-level feature. But any language intended for
system-level programming (operating system, embedded, whatever) is
going to have some mechanism for doing machine-level operations. I
used Ada as an example because I'm very familiar with it, but I'm sure
other languages have similar features. Pascal in its purest form
doesn't because it was designed as a teaching language -- but I expect
that any Pascal dialect that's actually used in the real world allows
low-level operations.

[snip]
You are missing my point. It has nothing to do with whether C generates
a diagnostic. And I'll happily accept the cast to be rid of it. Point
is I can manipulate memory pointers in C very easily, nearly as easily
as I can in assembler.

Ok. That doesn't make C an assembler.

[...]
Yes in C I need to consider the significance of pointer types. But this
is analogous to assembler opcode options.
MOVB -- move a byte
MOVW -- move a word
MOVL -- move a longword

C assigns types to *variables*. In a typical assembler, you have to
choose the proper operation yourself; the operands don't have any type
that the assembler can use to determine which operator to use.

[...]
Actually I'd assign type short to that integer. Good point though. You
made me see I picked the wrong argument. Back to the machine with 9bit
CHAR. In C the MAX_INT is dependent on the underlying processor and is
allowed ro range up to what the hardware can handle, so instead of
32768, you can go up to 131071 Other HLLs do not let that happen. the
max int in PASCAL is 32767, even on that same machine. A High level
language was supposed to get us away from thinking about the underlying
hardware wasn't it?

No, the value of maxint in Pascal is implementation-defined. (I think
the original Pascal implementation had 60-bit ints.)

Defining specific machine-independent sizes for integer types is
actually fairly unusual; Java does this, but most other languages I'm
familiar with don't.

[...]
That's it. We just differ on the scale.

Yes, we do.
I don't have a stron sense of the distances. I guess I would put C
about equidistant from both assembler and PASCAL.

No one-dimensional scale can possibly capture the nuances of a set of
dissimilar programming languages. But intuitively speaking, I still
say that C and Pascal are much closer to each other than either is to
any assembly language.

[...]
Great discussion. Thanks for the informative replies.
Ed.

Likewise.
 
K

Keith Thompson

Alf P. Steinbach said:
* Keith Thompson:

Sorry, that's bullshit.

However, show me a definition of bullshit (by "definition", I mean
something that unambiguously allows you to determine whether something
is bullshit or not) and I'll readily retract that statement. ;-)

If you're not interested in having this discussion, just say so.

If you think my request was unreasonable, please explain why.

I obviously don't know what you mean by "assembly language". I know
(more or less) what *I* mean by "assembly language", and as I
understand the term, it simply doesn't apply to C. Since you think it
does, explaining what you mean by the term would likely be helpful, at
least in establishing just where it is that we disagree.

Or you can keep swearing at me, and I can ignore you.
 
A

Alf P. Steinbach

* Keith Thompson:
If you're not interested in having this discussion, just say so.

First: we have now, satisfactorily to me, demonstrated that your request
on behalf of "us" for a really clear-cut definition of a vaguely defined
part of a term as used in contexts other than in that term, had no
bearing whatsoever on anything, other than as emotional rhetoric.

Even just the second word of that question, "us", almost blew up my
bs-meter!

So in the great American tradition, I planned to sue you -- or
somebody -- but happily the meter is now (seemingly) working again.

Then to your question, which AFAICS has nothing to do with the quoted
material:

I don't know what "the" discussion is, except it seems that some people
are being offended by having C likened to assembly language. I think
that inferiority complex could be an interesting background to various
discussions, if we just take pains to introduce that angle, e.g. how C
does not (seemingly) hold any advantage as a .NET language, and will
similarly lose terrain and become more of a specialist's niche language
when other such platforms come about, as they must. But, you want to
only discuss how the terminology evolved, or who invented it, if it was?
I'm no historian. But, one does not need to be a historian to
understand what it means: the meaning can be derived logically.

If you think my request was unreasonable, please explain why.

If you think /my/ like follow-up request was unreasonable, please
explain why.

I obviously don't know what you mean by "assembly language". I know
(more or less) what *I* mean by "assembly language", and as I
understand the term, it simply doesn't apply to C. Since you think it
does, explaining what you mean by the term would likely be helpful, at
least in establishing just where it is that we disagree.

Consider that there is an inherent conflict beween "portable" and
traditional meanings of the term "assembly language". Yes, we can
emulate one computer on another, Church and Turing showed that, but that
isn't a meaningful interpretation of "portable". And we can run virtual
machines such as JVM and CLR (or even old UCSD p-code, or LISP...) that
are essentially equivalent on all computers, and have a "JVM assembly
language" (o/w) that's effectively portable, but we don't call that a
portable assembly language -- because it's not the language that's
portable, it's the virtual machine that it's a language for. And I
could go on listing cases where "portable" isn't a meaningful addition.
E.g. saying 80386 assembly is "portable" because it can be used with a
Pentium is ridiculous, and I think you already agree to all this.

Something must therefore give, rather radically, if the term "portable
assembly" is to be meaningful, if we are to make sense of what someone
means when he or she cries "portable assembly!". And since the aim then
is to keep some meaning for "portability", what must give is some of the
non-portable details usually associated with an assembly language. Away
goes register names, registers as such (but not the concept), source and
destination as part of instruction, the whole of interrupt/hardware
exception handling (it was different on different processors), i/o
instructions, any machine-specific instructions (like interlocked
increment, whatever), and so on, and voila, just add syntax to the
remains, the little core left behind, and you have C, or PL/M, or SPL,
or whatever your to-the-iron "systems language" favorite is.

Or, you can decide that the term isn't meaningful to you, and thus fail
to understand (or at least make it seem to others as if you fail to
understand) all statements made about portable assembly language.

Or you can keep swearing at me, and I can ignore you.

Ah, that's... OK! OK! I shall not say the word. You know what. ;-)

One reason why that term, "portable assembly", is still practically
useful and mentioned here and there, even on the web, is that "systems
language" has been watered down so that even original Pascal, a language
only useful for learning programming by hand-compiling simple programs,
now qualifies as a systems language.

That single reason is IMO enough to keep the term floating around, but
ironically it derives its usefulness from not being used very much, and
so not already having been watered down to mean nothing at all...
 
A

Andrew Reilly

No one-dimensional scale can possibly capture the nuances of a set of
dissimilar programming languages. But intuitively speaking, I still
say that C and Pascal are much closer to each other than either is to
any assembly language.

I think that the thing about C that makes it "like (macro) assembler", for
me, has nothing to do with the level of control or the low-level-ness of
the feature set, although (a) that helps and (b) I think that it's been
eroded a bit, over the years, so that conforming code will run on a wider
variety of hardware.

The thing that's special about C (and perhaps Fortran and Forth) is that
what happens is what the code says to happen, nothing more. There is very
little "magic" about C. The language doesn't insert code for run-time
array bounds checks (as in Pascal, Java, most others.) The language
doesn't create invisible data structures to support it's object
abstractions (VTables and RTT-info in C++). While you can run C code with
a conservative garbage collector, like Bohem's, there isn't going to be a
magic mechanism moving things around in memory behind your back. (Well,
not unless you are using a particularly virulent interpretation of the
standard, and something like safec that has decorated pointers of some
sort.)

Even the loop constructs are basically just ways to put labels and
branches into the code. They don't even constrain the form of the
conditional expression, or the variant-update parts. Just labels and
branches.

Yes, C does do a small amount of magic. It magically marshalls arguments
onto a stack for subroutine calls, and may "promote" some along the way.
Yes, it will do a block-copy for you if you do a structure assignment.

The relative lack of magic is the important factor, IMO.

(Pascal's magic level is pretty low, too, so I do agree that it's pretty
close to C in this particular spectrum. Range checking is about the limit
of magic, here.)
 
C

CBFalconer

Andrew said:
.... snip ...

Yes, C does do a small amount of magic. It magically marshalls
arguments onto a stack for subroutine calls, and may "promote"
some along the way. Yes, it will do a block-copy for you if you
do a structure assignment.

The relative lack of magic is the important factor, IMO.

(Pascal's magic level is pretty low, too, so I do agree that
it's pretty close to C in this particular spectrum. Range
checking is about the limit of magic, here.)

Even lower than you think, especially when the programmer has taken
advantage of sub-ranges and typed everything as tightly as
possible. In this case a good Pascal compiler can compute the
possible range of expressions, and avoid most runtime checks. This
has the minor disadvantage of not checking for hardware errors.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
 
K

Keith Thompson

Alf P. Steinbach said:
* Keith Thompson:

First: we have now, satisfactorily to me, demonstrated that your
request on behalf of "us" for a really clear-cut definition of a
vaguely defined part of a term as used in contexts other than in that
term, had no bearing whatsoever on anything, other than as emotional
rhetoric.

Even just the second word of that question, "us", almost blew up my
bs-meter!

Then to your question, which AFAICS has nothing to do with the quoted
material:

I don't know what "the" discussion is, except it seems that some
people are being offended by having C likened to assembly language. I
think that inferiority complex could be an interesting background to
various discussions, if we just take pains to introduce that angle,
e.g. how C does not (seemingly) hold any advantage as a .NET language,
and will similarly lose terrain and become more of a specialist's
niche language when other such platforms come about, as they must.
But, you want to only discuss how the terminology evolved, or who
invented it, if it was? I'm no historian. But, one does not need to
be a historian to understand what it means: the meaning can be derived
logically.
[snip]

Apparently I have failed utterly to make myself clear. I'll try one
last time.

You claim that C is, in some sense, an assembly language
(specifically, a "portable assembly language"). I'm assuming here
that any "portable assembly language" is an "assembly language".

I claim that C is not an "assembly language", though it may bear some
resemblance to one.

I am not offended by the claim, I simply disagree with it. My
disagreement is based on my knowledge of the C programming language
and my understanding of what is meant by the term "assembly language".
(I haven't tried to provide a definition of the term myself; I might
or might not make the attempt later.)

I used the word "us" simply because we are having this discussion in a
public forum. Anything you post here will be read by multiple people,
including me -- thus "us". Nothing more.

There should be some definition of the phrase "assembly language". If
C is an assembly language, then C should meet the requirements of that
definition. This line of reasoning seems obvious and unremarkable to
me; do you disagree?

[...]
Consider that there is an inherent conflict beween "portable" and
traditional meanings of the term "assembly language". [...]
Something must therefore give, rather radically, if the term "portable
assembly" is to be meaningful, if we are to make sense of what someone
means when he or she cries "portable assembly!".

I agree. It does not follow from this, though, that the term
"portable assembly language" is necessarily meaningful, or that it
applies to C even if it is meaningful.

If someone cries "portable assembly", I can either figure out what
they mean, or I can decide they're crying nonsense. I'm content to do
either or both.

So, finally, what do you mean by "assembly language"?
 
A

Alf P. Steinbach

* Keith Thompson:
You claim that C is, in some sense, an assembly language

Nope, as you know I haven't claimed that. Whenever you're referring to
a claim, be sure to quote that claim. Especially when your previous
attempt at making the claim-making stick has been shown as fallacious.

(specifically, a "portable assembly language").
I'm assuming here that any "portable assembly language" is an "assembly language".

That assumption does not hold.

However, that was explained twice, in detail, in the posting you now
replied to, and yet here you are making the same nonsense assumption.

OK, example.

Example 1.

Cheery Unstoppable Keith: "How's your cycle, by the way?"
Puzzled Maria: "Fine, just fine?"
Cheery Unstoppable Keith: "So you don't share it with others?"
Puzzled Maria: "That happened five years ago, when we all
lived together. You want to borrow it?"
Cheery Unstoppable Keith: "Huh, you think I'm transsexual!?!"
Puzzled Maria: "/What/?"
Cheery Unstoppable Keith: "Don't try that on me! I know what you're
thinking! What you're /implying/!"
Puzzled Maria: "Uh oh... Keith, say, you'd like a beer or
something? I'll go fetch it. Right back!"

In this highly educational example, note that the "MotorCycle" that
Puzzled Maria is thinking of, is not a "Cycle" that Cheery Unstoppable
Keith is thinking of. Just chopping off the word "Motor" does not make
a "MotorCycle" into a "Cycle". Well, OK, it does, but not /that/ kind.

I have numbered this example in case more examples will be needed; then
the numbers may make it easier to refer unambigiously to the examples.


[snip]
There should be some definition of the phrase "assembly language".

Try <url: http://en.wikipedia.org/wiki/Assembly_language>; although not
a reference nor of reference-quality, it's good enough for any novice
level in-practice discussion or just learning what the term means very
roughly.

If
C is an assembly language, then C should meet the requirements of that
definition. This line of reasoning seems obvious and unremarkable to
me; do you disagree?

No, I don't disagree; it's fine on its own, and it's irrelevant.

[...]
Consider that there is an inherent conflict beween "portable" and
traditional meanings of the term "assembly language". [...]
Something must therefore give, rather radically, if the term "portable
assembly" is to be meaningful, if we are to make sense of what someone
means when he or she cries "portable assembly!".

I agree. It does not follow from this, though, that the term
"portable assembly language" is necessarily meaningful, or that it
applies to C even if it is meaningful.

If someone cries "portable assembly", I can either figure out what
they mean, or I can decide they're crying nonsense. I'm content to do
either or both.

Yes, you can either assume some meaning, in which case you'll end up
with essentially my analysis (perhaps differing in some detail), and
will be able to understand e.g. that Wikedia article referred to earlier
in the thread, which used that (to you) troublesome term.

Or, you can say, I regard this term as meaningless, I refuse to consider
any meaning, I want to be forever ignorant except as enlighened by some
of my chosen Holy Books (e.g. the C and perhaps C++ standards).

So, finally, what do you mean by "assembly language"?

I think that should be clear since I've now used the term, but one
important difference from the Wikipedia definition is that I do regard
e.g. "CLR assembly language" (CIL, Common Intermediate Language) as an
assembly language, i.e. I include assembly languages for virtual
machines among the assembly languages, and I do not exclude assembly
languages that have some OO features, such as TASM had and CIL has.

However, note well again for the umpteenth time (some time it must sink
in, I hope) that that's irrelevant: I only answer it because you ask.
 
K

Keith Thompson

Alf P. Steinbach said:
* Keith Thompson:

Nope, as you know I haven't claimed that. Whenever you're referring
to a claim, be sure to quote that claim. Especially when your
previous attempt at making the claim-making stick has been shown as
fallacious.

Here's what you wrote upthread:

] C was designed as a portable assembly language, the most successful so
] far, so if the term has any practical meaning, then C is that meaning.
]
] C was designed as a portable assembly language for the purpose of
] porting Unix (which then had some seven or ten installations, I
] forget, but one rumor has it there was only one, namely the PDP-7)
] more easily. That didn't fully remove the need for using actual
] assembly. But only some small parts still needed to be
] machine-specific assembly.
That assumption does not hold.

So you're using the term "portable assembly language" while insisting,
in contradiction to ordinary English grammar, that a "portable
assembly language" is not necessarily an "assembly language".
("Portable" is an adjective; "assembly language" is a noun phrase.)
And yet you seem surprised that I'm having trouble figuring out what
you're talking about.

I'm done here.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top