B
Ben Bacarisse
Jon said:Explain please "second class nature of arrays".
The term has a standard meaning in this sort of context:
http://en.wikipedia.org/wiki/First-class_object
<snip>
Jon said:Explain please "second class nature of arrays".
Jon said:August Karlstrom wrote:
The litmus test (C syntax):
a = sqrt(b^2 + c^2)
Anyone suggesting anything is more obvious (about the equal symbol) than
the above is a dufus. a "equals what I tell you it equals", *I* am the
programmer. The STATEMENT (not a ponderance), says, evaluate that
expression and put the result where *I* wanted. (What all you
mathematicians are up about, I will consider).
* BartC said:In other contexts, a pointer/array attribute is part of the type, eg. in
casts (and the dereference symbol appears on the right).
Jon said:#define Alias typedef
If the preprocessor is not your friend, then C will be your enemy. You're
welcome.
Yes. A similar argument explains manicotti.
Seebs said:Yes. A similar argument explains manicotti.
BartC said:I don't know how you deduced that from my statement.
Jon said:That solution has been tried many times and has been found to be
inadequate as many times as it has been tried. It can't be fixed at the
library level because it's a language level problem.
Rui Maciel said:This is not up to debate: if you fail to understand how to assign values
to variables in a
programming language then you simply don't know how to use it.
BartC said:The project happened to be mixed language. Also, the problem wasn't so
much using ":=" in C, which is quickly picked up as a syntax error, as
using "=" in the other language, which was still legal but did bad
things that were hard to track down.
Since I'd used the other language for many years (having invented it),
I don't think the problem was not knowing how to use it. Just getting
muddled (because the designers of C inconsiderately used the wrong
assignment symbol...)
The assignment operator `=' will confuse any newcomer with a basic
knowledge of mathematics. You can only imagine how many bugs it has
caused in C and C++ when being inadvertently used as an equality
operator instead of `=='. In code comments it also makes the usage of
the mathematical `=' slightly ambiguous which forces people to use `=='
instead. UGLY is the word.
It's a shame that a left arrow is not in the (7 bit) ASCII table. IMHO
`:=' is second best to the left arrow.
I'm programming in a mixed environment of C, Javascript, a HTML
templating language with loop constructs and a home-brew scripting
language. Not to mention little bits of embedded SQL, make files and
similar.
It's not that uncommon to get an error because I've put a semicolon on
the end of a line in the scripting language, or used == in it.
Michael Foukarakis said:I don't know. I learnt C pretty young, and I was able to distinguish
between '=' and '==', thanks to three subtle notions:
a) They differ by one character.
b) I knew the quantitative difference between 1 (one) and 2 (two).
c) I was told they had different behaviour.
...from attempting to compile other people's open
source projects, it seems to me that a C programmer needs to know 4
languages:
(A) The C syntax itself
(B) The preprocessor language...
(C) Type declaration syntax...
(D) Make-file syntax...
That solution has been tried many times and has been found to be
inadequate as many times as it has been tried. It can't be fixed at the
library level because it's a language level problem.
BartC said:I don't know how you deduced that from my statement.
BartC said:In fact, in the real world outside of C programming, "=" to mean
equality is pretty much universal.
Joe Wright said:The xBASE languages use the = sign for both assignment and equality by
examining the context in which it is used.
Kenneth Brody said:On 10/15/2010 12:23 PM, Joe Wright wrote:
[...]The xBASE languages use the = sign for both assignment and equality by
examining the context in which it is used. For example:
a = 42
is an assignment and..
if a = 42
is a test for equality.
But, you apparently can't do things like:
if ( f = fopen(filename,mode) )
or
while ( pt = NextItem() )
True, I would write them:
if ( (f = fopen(filename,mode)) != NULL )
or
while ( (pt = NextItem()) != NULL)
but it appears that there would be no equivalent in xBase.
* Ben Bacarisse said:I have no idea how far from universal "pretty much universal" is but I
can think of:
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.