C Pointer problem

J

Joe Wright

Flash said:
Keith said:
Does British English not commonly use the terms "parentheses" and
"braces"?

Parentheses was used in my maths class as school in Britain oh so many
years ago and we were told that it, and not brackets, was the correct
term for (). However, it was certainly common back then for people to
describe () as brackets.

So I, born and brought up in England, am happy with the terms
parenthesis (), brackets [] and braces {} but can also accept and cope
with round brackets, square brackets and squiggly brackets. I'll also
accept brackets for () without comment if the context removes any
ambiguity.
I understand that "braces" refers to the clothing accessory that
Americans refer to as "suspenders", but there seems to be little
chance of confusion.

Yes, this is also true. Assuming, of course, that Americans common call
braces suspenders. However, you should possibly be aware that in Britain
suspenders are used by ladies to hold their stockings up, so be careful
what you ask for in a clothing store in Britain ;-)

Ah the innocence of youth. English suspenders are American garters. My
grandfather wore garters to hold his socks up.
 
M

Mark McIntyre

Should I wait for you to re-post acknowledging your mistake,

T'would be tricky to do that, since there isn't one.
If we multiply first,

Oh, you mean solutions that break the rules of maths. I see, I thought
you meant actual solutions. If we're going to allow fantasy maths,
then I really must introduce you to my fascinating proof that 1==2

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
M

Mark McIntyre

Which part of "if we multiply first" escaped you?

The part where the original expression contained some prior
multiplication.

"Dad, if I take three people and three more people, and divide the
group in two, how many people do I have?"

"None".

"how so?"

"if you divide them first, you have six dead people".
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
R

Robert Gamble

K

Keith Thompson

Mark McIntyre said:
T'would be tricky to do that, since there isn't one.


Oh, you mean solutions that break the rules of maths. I see, I thought
you meant actual solutions. If we're going to allow fantasy maths,
then I really must introduce you to my fascinating proof that 1==2

The rule that multiplication and division have the same precedence is
a rule of mathematical *notation*, not a fundamental rule of
mathematics.

Different languages have different notational rules. In both C and
the brand of ordinary arithmetic notation that you and I both learned,
multiplication and division happen to have the same precedence. In
APL, if I recall correctly, there are no precedence levels; everything
is evaluated right-to-left (if that's not the actual rule for APL,
it's at least a possible consistent one). Lisp specifies everything
with parentheses. And so Forth.

A notation in which multiplication and division have different
precedence levels could be perfectly internally consistent.

Whether such a notation is actually in use anywhere is another
question (and not a particularly topical one), but there should be no
difficulty imagining how such a system would work.
 
C

Chris Dollin

Mark said:
The part where the original expression contained some prior
multiplication.

The expression had the form `a * b / c * d`. Since this isn't
fully bracketed, some convention must be adopted for deciding
which operands belong to which operators. This convention is
just that - a /convention/. For rantable reasons, this convention
is often expressed in terms of "what operators get done first",
with an operational procedure of "find the next operator to be
done and evaluate it with the nearest (shortest) operands".
Fortunately, mathematical expressions don't have (side-)effects,
so all this does is set people up for glorious errors when they
encounter imperative programming languages.

"If we multiply first" is a way of expressing a precedence
relation. No "prior multiplication" is involved.
"Dad, if I take three people and three more people, and divide the
group in two, how many people do I have?"

"None".

"how so?"

"if you divide them first, you have six dead people".

An excellent illustration of how choosing different precedence
rules will get you different answers, although "divide the
group into two" applies excessive disambiguation pressure.
 
G

goose

Ian said:
Keith Thompson wrote:

"suspenders" hold up women's stockings, so talk of a man in suspenders
can cause all sorts of confusion!

The joys of a common language..

you meant C, right?

goose,
'cos english aint/isn't what it used to be :)
 
M

Mark McIntyre

The expression had the form `a * b / c * d`. Since this isn't
fully bracketed, some convention must be adopted for deciding
which operands belong to which operators.

Agreed. The point is however, conventions are just that, agreed by
convention. One can say "the answer is x not Y because I don't follow
conventions" but one can't then expect to be treated seriously.
An excellent illustration of how choosing different precedence
rules will get you different answers,

Actually, I thought it was an excellent example of why ignoring
convention will give you absurd answers.
although "divide the
group into two" applies excessive disambiguation pressure.

Carefully worded :)
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
M

Mark McIntyre


The first has the beauty of simplicity, but the second is more subtle
since it uses a 'common sense' rule to introduce the fallacy.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
M

Mark McIntyre

The rule that multiplication and division have the same precedence is
a rule of mathematical *notation*, not a fundamental rule of
mathematics.

I agree. How does this contradict what I said?
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
K

Keith Thompson

Mark McIntyre said:
I agree. How does this contradict what I said?

Since you ask, you referred to "solutions that break the rules of
maths". I distinguish between rules of mathematics (such as how
addition and multiplication work) and notational conventions. A proof
that 1 == 2 violates the former; an interpretation of 4 * 12 / 3 * 8
other than the usual one merely violates the latter.
 
M

Mark McIntyre

I distinguish between rules of mathematics (such as how
addition and multiplication work) and notational conventions.

FCOL. Its not a "notational convention" and even if it were, you can't
simply discard it. Otherwise why bother at all.


--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
D

Dave Thompson

Dave Thompson wrote:
[The PP] obviously meant brackets in the en_GB (or UK?)
meaning, what en_US (and the standard) calls parentheses.

The example shown had empty parentheses and empty braces
and he was saying something that you suggest was false
about empty brackets.
So where's my clue as to what he's talking about?

His statement, to which I responded, was about the difference
between an old-style function definition
int foo () { body }
which specifies no parameters, and a declaration-only
int foo () ;
which does not specify parameters/signature.

He claimed the former is equivalent to (void) (a prototype)
and I quoted and responded specifically to that point,
with cites that were specifically about function declarators,
parameter-type lists and identifier lists, all of which in the
standard grammar involve rounds and not curlies.

Those seem like enough clues to me.

- David.Thompson1 at worldnet.att.net
 

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

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top