Posted: Fri Oct 05, 2007 2:53 am
OP: Yes, I believe pascal is (was) used extensively for kernel development. Some people here are kernel-ing in pascal, I believe.
The Place to Start for Operating System Developers
http://f.osdev.org/
My point is that <=, >=, == et al are used in MANY different programming languages and not just C. That's what I'm taking exception to.Back to the +=. In C you don't use = for comparison, right? You just use it for assignment, right? Not really. In the following operators = is used for assignment:
=
+=
-=
*=
/=
%=
>>=
<<=
&=
|=
^=
In the following operators = is used for comparison:
<=
>=
!=
If == means equal and < means less than, less than or equal would be <==. If += means add and assign, <= should mean compare to less and assign.
To me, this statement does not make sense. Can someone elaborate on this statement? "Compare to less and assign"--assign what? o.0<= should mean compare to less and assign.
Code: Select all
mov eax, [a]
mov ebx, [b]
cmp eax, ebx
cmovl [a], eax
Code: Select all
a <= b;
I see what you mean, but then again i can come up with many "(?)=" that wouldnt make sence.neon wrote:To me, this statement does not make sense. Can someone elaborate on this statement? "Compare to less and assign"--assign what? o.0<= should mean compare to less and assign.
This right here is my reasoning at why they did not do this. It simply has no meaning.
Why would assume that? It wasn't. It was in comparison with how good it COULD have been. It's not in comparison to any other language. It's not my fault that you read something I didn't write.JamesM wrote:No, the initial point was a rant (by Craze Frog, not you) about how terrible C is. I would assume this was in comparison with other current languagesZacariaz wrote:It is not of any importants how things are done currently, what is the subject of this part of the discussion is whether it can be done better, and i believe it can.JamesM wrote:Please name me an imperative programming language that does not use the '=' character in both assignment and comparison (with the obvious exception of bash (-eq) ).
Code: Select all
PROGRAM EUCLID
PRINT *, 'A?'
READ *, NA
IF (NA.LE.0) THEN
PRINT *, 'A must be a positive integer.'
STOP
END IF
PRINT *, 'B?'
READ *, NB
IF (NB.LE.0) THEN
PRINT *, 'B must be a positive integer.'
STOP
END IF
PRINT *, 'The GCD of', NA, ' and', NB, ' is', NGCD(NA, NB), '.'
STOP
END
I still don't understand you. Do you mean you want to use '=' as the equality operator? likeSecond: I want to use = for both comparison and assignment. In C, I can't! Only for some comparisons. That does not make sense.
Code: Select all
int a = 3;
if (a = 3) print("foo");
Code: Select all
if (!(stream = fopen(<bleh>))) exit(1);
No, I said it's logical that '==' means "test for equality" in ANY situation, and '=' means "assign the value of" in ANY situation. I still think you don't quite comprehend what you're saying...You say that it's logical that == means equality in one situation and = means equality in some other situation. That's simply not logical no matter how you turn it.
One of the reasons C has both = and == operators is for readability. We can quickly note what this is doing just by its operators.Second: I want to use = for both comparison and assignment. In C, I can't! Only for some comparisons. That does not make sense.
Code: Select all
if ( (a = (b == 1) ? 0 : 1) == 1) {
if (c == 0)
c = 1;
}
Code: Select all
if ( (a = (b = 1) ? 0 : 1) = 1) {
if (c = 0)
c = 1;
}
I second that motion.JamesM wrote:Either way you piss me off.
Yes, that's logical, but it's not how it works in C.JamesM wrote:No, I said it's logical that '==' means "test for equality" in ANY situation, and '=' means "assign the value of" in ANY situation. I still think you don't quite comprehend what you're saying...You say that it's logical that == means equality in one situation and = means equality in some other situation. That's simply not logical no matter how you turn it.
But it is...Craze Frog wrote:Yes, that's logical, but it's not how it works in C.JamesM wrote:No, I said it's logical that '==' means "test for equality" in ANY situation, and '=' means "assign the value of" in ANY situation. I still think you don't quite comprehend what you're saying...You say that it's logical that == means equality in one situation and = means equality in some other situation. That's simply not logical no matter how you turn it.