Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2019-08-05 00:00:00Z and 2019-08-06 00:00:00Z
Avatar
ChillerDragon 2019-08-05 08:39:58Z
I have a variable representing money and it is a sqlite3_uint64 and the compiler yells at me when i compare it against signed integers which makes sense.. but I am not sure how to fix it.
Avatar
u should tell what it yells
Avatar
ChillerDragon 2019-08-05 08:40:30Z
I was thinking about converting the normal integers to unsigned as well by creating a new variable for the comparison.
08:40
The compiler says comparision between signed and unsigned int
08:41
u should decide to cast one
08:41
either the signed or the unsigned
08:41
i guess
Avatar
ChillerDragon 2019-08-05 08:42:26Z
yea
08:42
but how to cast xd
08:42
in the ifstatment?
Avatar
r u in c
08:42
or c++
Avatar
ChillerDragon 2019-08-05 08:42:43Z
c++
08:42
tw
08:42
i guess u hate modern
08:42
so
Avatar
ChillerDragon 2019-08-05 08:42:55Z
xd
Avatar
ChillerDragon 2019-08-05 08:43:03Z
ya thought so
Avatar
in modern i think it would be static_cast<int>()
08:43
xd
Avatar
ChillerDragon 2019-08-05 08:43:22Z
but can that casting mess something up
Avatar
well yes
Avatar
ChillerDragon 2019-08-05 08:43:30Z
i mean it is money
Avatar
u should then just store money in signed
Avatar
ChillerDragon 2019-08-05 08:43:42Z
so i shouldnt fuck that up or fokko exploits the shit of mi server
Avatar
if it gives u so much trouble
08:43
not like u will have max int money
08:43
or just use a long
Avatar
ChillerDragon 2019-08-05 08:44:07Z
but longs are so small
Avatar
no they arent
Avatar
ChillerDragon 2019-08-05 08:44:16Z
how to fit in the money of rich ppl
Avatar
+9,223,372,036,854,775,807
08:44
its not small
Avatar
ChillerDragon 2019-08-05 08:44:56Z
thats a long?
Avatar
ChillerDragon 2019-08-05 08:45:06Z
that looks kinda good
Avatar
ChillerDragon 2019-08-05 08:45:25Z
i thought when i looked the last time it showed a smaller number
08:45
but the thing is i thought ill be saver with unsigned since nobody should ever have negative money
Avatar
if u handle ur logic correctly
08:46
then no one will have negative
08:46
and in real world is possible to have negative money btw
08:46
when u owe shit
Avatar
ChillerDragon 2019-08-05 08:46:33Z
meh i thing i switch back to long
08:46
wait or isnt the long long? or int64
08:46
wasnt that bigger
08:47
or less supportet? idk
Avatar
long and long int are identical. So are long long and long long int. In both cases, the int is optional. As to the difference between the two sets, the C++ standard mandates minimum ranges for each, and that long long is at least as wide as long.
08:47
from stackoverflow
08:47
I am transitioning from Java to C++ and have some questions about the long data type. In Java, to hold an integer greater than 232, you would simply write long x;. However, in C++, it seems that lo...
08:48
long is a int64
08:49
Long and long int are at least 32 bits. long long and long long int are at least 64 bits.
08:49
but if ur compiler is 64bit long will probs be 64bit
Avatar
ChillerDragon 2019-08-05 08:49:28Z
i guess ill use int64 then xd
08:49
how it was before
08:49
it has been always like this
Avatar
ChillerDragon 2019-08-05 08:50:14Z
i mean that datatype i used before
08:50
was int64 so ill go back to that
08:50
i replaced it with sqlite3_uint64 at some point uz i thought i was smart
08:50
xd
Avatar
ChillerDragon 2019-08-05 08:59:34Z
ty ryo
08:59
10/10 search engine as always
Avatar
ChillerDragon 2019-08-05 09:11:12Z
/q
09:11
/quit
09:11
meh how to close discord xd
Avatar
ctrl shift q
Avatar
@Ryozuki long is 32 bit on 32 bit systems and on 64 bit windows
12:09
use explicitly sized types instead (int64_t)
Avatar
ye thats what i said
Avatar
woops
Avatar
Long and long int are at least 32 bits. long long and long long int are at least 64 bits.
12:10
right?
Avatar
in practice, that's right I think
12:12
uh, apparently it's even guaranteed by the standard
12:12
but just specify the bit width explicitly 😉
12:18
Note: as with all type specifiers, any order is permitted: unsigned long long int and long int unsigned long name the same type.
Avatar
C11 adds long long int, it is guaranteed to fit 64bits
13:29
Oh already answered
Avatar
ac588f3 Fix crashbug on set_team_ddr -1 - fokkonaut 265d3b8 Fix namings - fokkonaut b0f1164 Merge #1883 - bors[bot]
Exported 85 message(s)