Page 2 of 3

Posted: Thu Oct 12, 2006 12:50 pm
by CIH
that's kinda the point....

Posted: Thu Oct 12, 2006 10:19 pm
by d3jake
:razz:

Posted: Thu Oct 12, 2006 10:39 pm
by Taristin
Wait... why are we picking on Greg?

Posted: Fri Oct 13, 2006 12:22 am
by aldo
Taristin wrote:Wait... why are we picking on Greg?
Because it's fun :D

Posted: Fri Oct 13, 2006 1:06 am
by Robo
Roanoke wrote:
Robo wrote:He'd never attend a gathering if I came along. He has a phobia of me, as does Bev.
maybe it's the pork scratchings and Boddies bitter..... :badgrin:
Jesus those scratchings are horrible.

Posted: Fri Oct 13, 2006 3:23 am
by d3jake
Taristin wrote:Wait... why are we picking on Greg?
Who's Greg?

Posted: Fri Oct 13, 2006 3:34 am
by Taristin
Wow. Way to follow the conversation.

Posted: Fri Oct 13, 2006 3:02 pm
by CIH
who are you ?

where am I ?


who am I ?

:shock: :shock:

Posted: Sat Oct 14, 2006 12:04 am
by d3jake
Greg = Grug...?

Posted: Sat Oct 14, 2006 5:56 am
by Hippo
= is the assignment operator, therefore has no t/f value;

Posted: Sat Oct 14, 2006 8:32 am
by ngtm1r
In certain situations.

Posted: Sat Oct 14, 2006 12:57 pm
by karajorma
Actually

if (a = b)

will compile in many languages.

Posted: Sat Oct 14, 2006 6:34 pm
by Hippo
compile, yes... it is completely valid to assign in a boolean check, however it will evaluate funkily

Posted: Sat Oct 14, 2006 7:55 pm
by d3jake
that won't compile in C++, you'd need two =='s so there!

Posted: Sat Oct 14, 2006 8:07 pm
by Hippo

Code: Select all

#include <iostream>
using namespace std;

int main(){

	if(a = b)
		cout << "a = b";
	else
		cout << "a != b?";
	return 0;
}
1>------ Build started: Project: board101306, Configuration: Debug Win32 ------
1>Compiling...
1>random.cpp
1>c:\comp128\board101306\random.cpp(6) : error C2065: 'a' : undeclared identifier
1>c:\comp128\board101306\random.cpp(6) : error C2065: 'b' : undeclared identifier
1>Build log was saved at "file://c:\Comp128\board101306\Debug\BuildLog.htm"
1>board101306 - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


So if i were to declare the variables...

Code: Select all

#include <iostream>
using namespace std;

int main(){
	int a, b;
	if(a = b)
		cout << "a = b";
	else
		cout << "a != b?";
	return 0;
}

It does in fact compile

1>------ Build started: Project: board101306, Configuration: Debug Win32 ------
1>Compiling...
1>random.cpp
1>c:\comp128\board101306\random.cpp(6) : warning C4700: uninitialized local variable 'b' used
1>Linking...
1>Embedding manifest...
1>Build log was saved at "file://c:\Comp128\board101306\Debug\BuildLog.htm"
1>board101306 - 0 error(s), 1 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

however...



it will give a debug error on launch, but returns true despite.