MRT
do
{
printf(" READY \n");
ClientSocket = accept(ListenSocket, NULL, NULL);
if (ClientSocket == INVALID_SOCKET)
{
printf("accept failed with this fucking Error: %d\n", WSAGetLastError());
closesocket(ListenSocket);
WSACleanup();
return 1;
}
HandShakeThreadClass *_handShakeThread = new HandShakeThreadClass(&ClientSocket);
_handShakeThread->StartInternalThread();
continue;
} while (is_active);
MRT
after i declare class in there HandShakeThreadClass *_handShakeThread = new HandShakeThreadClass(&ClientSocket);
_handShakeThread->StartInternalThread(); » ClientSocket memory address not changed in while
MRT
all ClientSocket have a same memory address
MRT
why ?
Anonymous
MRT
Socket should not have different addresses ?
MRT
socket accept from clients
Anonymous
In this case not, because you basically using the same variable
MRT
MRT
srry for wrting bad english
Anonymous
problem is do while ?
The problem is that you're using the same variable allocated on stack
MRT
im new in c++, you can fix my code to better understand ? ! thank
Henry
Please which is good
programming c in linux or window
Anonymous
Henry
Like programming in c
Anonymous
Henry
Writing c though
Henry
Anonymous
Henry
Like 😔 writing codes in c programming language
MRT
😂
Stay Forward
/saved
Andrey
/notes
Henry
/note
Henry
/notes
🇵🇭🇷🇺
🇵🇭🇷🇺
My mother taught me to defend myself, because no one has the right to judge somebody. There is only one lawgiver and judge, he who is able to save and to destroy. It's God 👆
Igor🇺🇦
🇵🇭🇷🇺
MRT
Roxifλsz 🇱🇹
Roxifλsz 🇱🇹
/warn offtopic, this is not a youtuber group lol
Anonymous
Anonymous
Guys why doesn't this condition work when x=0,
if (x<1 || x>8)
return 0;
Anonymous
It works when x is negative but not for x=0
Anonymous
Anonymous
Anonymous
Any negative number or number greater than 8 activates the condition
Anonymous
int x , no;
cin >> x;
while(x)
{
if ( x < 1 || x >= 1500)
return 1;
else
no *= 10;
}
Anonymous
In this code snippet, when x = 0, the code doesn't work as expected
Anonymous
int x;
cin»x;
Anonymous
Assuming that the while condition had any other variable apart from x, then the if condition works for x= 0
Anonymous
works perfectly well for me
Anonymous
Anonymous
tested for 0 and it works. something else in your code. this is not it
Anonymous
Not really, using code blocks as my ide
Anonymous
ah for 0 it does not enter the while
Anonymous
Anonymous
But for 1, it enters
Anonymous
I mean it works perfectly. for 0 the loop exits.
Anonymous
Anonymous
returns whatever is outside the while loop...0 does not trigger the while condition
Anonymous
Anonymous
Now, that I am thinking about it, the code is a total aberration. By the condition stated in the while loop, the code should always return 1 because x will at some point be 0. The code therefore is a total mess
Anonymous
:)
Anonymous
I meant x will always end up being 0 for any positive number in the range. So the behavior it's displaying is totally unexpected. Especially for not continuing with the loop when x=0 and simply just executing statements outside the loop for x= 0
Anonymous
Instead, the solution should be the conditional if else statement with the nested while loop
Anonymous
Anonymous
Thanks
inkfil
/cpp
Ikha
/cpp
Vedant
/cpp
inkfil
/cpp
Огни
/cpp
Nils
struct Variable {
enum Type {
id_string,
id_integer,
id_reference
} type;
union Data {
std::string string;
int32_t integer;
Variable *reference;
} data;
};
Any idea why I get "call to implicitly-deleted default constructor" when tring to use this struct?
labyrinth
string in a union is kind of weird isn’t it?
Anonymous
Anonymous
Use std::variant
Anonymous
It's less error prone and more convenient
Anonymous
using Variable = std::variant<std::string, int64_t, Variable*>;
labyrinth
But I don’t get the reason why it says implicitly deleted default constructor
Nils