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 2022-07-16 00:00:00Z and 2022-07-17 00:00:00Z
Avatar
Avatar
Voxel
Click to see attachment 🖼️
wowow looks so cool cant wait
Avatar
Avatar
Voxel
Click to see attachment 🖼️
nice
Avatar
Avatar
Voxel
@bluesky progress
hm?
Avatar
i was linking you to the photo
Avatar
Avatar
Chairn
which code do you prefer ? c++ new(pDemoHeader) std::remove_pointer<decltype(pDemoHeader)>::type; new(pTimelineMarkers) CTimelineMarkers;
I prefer std::make_unique
Avatar
I'm getting lots of these in the console
09:21
I can't find any references to the numbers in steam documentation idk what they mean
Avatar
[quakenet] ChillerDragon BOT 2022-07-16 10:08:26Z
stem
Avatar
Avatar
deen
I prefer std::make_unique
This is not the same, im using placement new to initialize objects rather than mem_zero. Im not allocating memory
Avatar
why even use new
10:33
*pPtr = CClass()
Avatar
you can do that?
10:34
i never tried 😄
Avatar
does new(buffer) CClass even call the destructor?
10:35
sounds rather dangerous to experiment with such things if you not sure what u doing
Avatar
placement new just call the constructor on the given address
Avatar
so the old object stays active?
10:35
or is not properly destructed
Avatar
old object is overridden
Avatar
so not properly destructed which was already the case before with mem_zero
Avatar
so its no improvement over mem_zero
10:36
u just make it just as bad xD
Avatar
well, they don't have destructor anyway, but i can still call it before if you want 🙂
10:39
looks like i can't call constructor: error: invalid use of ‘CNetConsole::CNetConsole’ 11 | this->CNetConsole()
Avatar
Avatar
Jupstar ✪
*pPtr = CClass()
this create new object on the stack rather than reinitializing old object, so not the same behavior
10:41
and the object is definitely destructed at the end of the function but it should live longer (edited)
Avatar
Use smart pointers everywhere
10:41
PES4_MadGe
Avatar
Avatar
Chairn
this create new object on the stack rather than reinitializing old object, so not the same behavior
?
10:42
where is the stack variable?
Avatar
CClass() is stack variable
Avatar
but there is an asignment
10:43
=
Avatar
Whats this new() thing as the type
10:43
stupid me
Avatar
also its not a variable, its a pure r value
Avatar
lel, assignment much better 🙂
Avatar
Ah places an object into allocated memory
Avatar
Avatar
Ryozuki
Whats this new() thing as the type
i don't understand your question
Avatar
The placement new thing
10:44
Never heard of it till today xd
Avatar
@Jupstar ✪ what would you do for array of objects?
10:45
placement new can init array but assignment requires loop
Avatar
it will also loop internally
10:46
bcs all objects will call constructor
Avatar
i know, im just lazy to type the loop
Avatar
dunno use foreach or smth
Avatar
Introduce CButtonContainer which is used for fading text in teeworlds. There is no fading text in ddnet yet. This change allows introducing such fading buttons but the main motivation for this change is easier copy & pasting code from ddnet to teeworlds code base.

Checklist

  • [x] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possibly related configuration options
  • [ ] Written a unit test (especially base/) or ad...
Avatar
ddnet/src/engine/client/favorites.cpp:229:23: error: 'data' should be used for accessing the data pointer instead of taking the address of the 0-th element [readability-container-data-pointer,-warnings-as-errors] int Index = pEntry - &m_aEntries[0]; ^~~~~~ (m_aEntries).data()

Checklist

  • [ ] Tested the change ingame
  • [ ] Provided screenshots if it is a visual change
  • [ ] Tested in combination with ...
Avatar
Avatar
Voxel
Click to see attachment 🖼️
so you are done with that? or is it just the menu yet, where you can define every color in its own preview function?
Avatar
well, clang does not know loop and gcc kinda store variable per variable:
Avatar
I do not update the list of servers (there is an eternal update), but only on windows 8.1, before that was windows 7 and everything worked fine, and before windows 7 was windows 8.1 and it also does not update, I think the problem is somehow connected with the system
17:03
🤔
Avatar
68261af Remove HappyFray from mods as he resigned - def-
tear 3
Avatar
"xd sure chillerbot.png is lyfe" lol
Avatar
@Tater damn before I went away a week ago I opened your shadertoy page. now that I'm back that was the first page I have open and I'm absolutely amazed :D
Avatar
Avatar
cauldron
so you are done with that? or is it just the menu yet, where you can define every color in its own preview function?
its just the menu
Avatar
i hate the fact that std::size cannot be used in a constexpr when the array is stored in a struct in a vector...
Avatar
hm, why?
Avatar
Avatar
Chairn
i hate the fact that std::size cannot be used in a constexpr when the array is stored in a struct in a vector...
show code or did not happen
Avatar
c++ constexpr int ArraySize = std::size(Container.m_vQuads[0].m_aVertices); // operator[] is not constexpr so compilation fails constexpr int ArraySize = sizeof(Container.m_vQuads[0].m_aVertices)/sizeof(Container.m_vQuads[0].m_aVertices[0]); // ok
Avatar
Ah, I see what you mean
Avatar
so its not about std::size or structs, but only about accessing an array 😄
Avatar
i tried everything
20:18
you cant use :: on non static member
Avatar
constexpr reference operator[]( size_type pos ); (since C++20)
Avatar
so i had to resort to the good old sizeof
Avatar
c++20 bro
Avatar
i wish we used c++ 20, i need auto generated operator==
Avatar
all versions before c++20 just suck no joke xD
20:19
and in 1 year i say the same with c++23
Avatar
i wonder what c++ will look like in 20 years
Avatar
in 20years KIs are coding what we want
20:20
we just type in the idea
Avatar
finally they will have implemented everything that people needed since 2000 :D (edited)
20:20
ki?
Avatar
AI
Avatar
what kind of keyboard do you have?
20:21
a and k are opposite side
Avatar
its the german shortcut
Avatar
i am just used to call it KI xD
Avatar
artificial = kartificial?
Avatar
künstliche
Avatar
in french its even worse, we use IA instead of AI
20:22
so i always mix them up
Avatar
@Chairn constexpr auto k = std::tuple_size<decltype(decltype(v_vec)::value_type::m_arr)>::value; maybe? 😄
Avatar
Avatar
Learath2
@Chairn constexpr auto k = std::tuple_size<decltype(decltype(v_vec)::value_type::m_arr)>::value; maybe? 😄
yeah i saw that, but i thought that sizeof should be enough
20:23
uh, the stackoverflow i saw had only one decltype
Avatar
use sizeof, put a comment TODO: c++20 u nobos
20:23
and its fine
Avatar
Avatar
Jupstar ✪
constexpr reference operator[]( size_type pos ); (since C++20)
I'm not sure if this is even fine in C++20 actually
20:24
Isn't that constexpr operator only available if the vector itself is constexpr?
Avatar
possible, but he uses it in a constexpr, so i assume it is?
20:25
or why is his function constexpr in first place
Avatar
Avatar
Jupstar ✪
or why is his function constexpr in first place
The size of the array inside the struct inside the vector is constant at compile time, the vector doesn't have to be constexpr for that
20:27
I wonder why std::array::size() can't be static aswell actually, that would solve this and be sane
Avatar
Avatar
Learath2
The size of the array inside the struct inside the vector is constant at compile time, the vector doesn't have to be constexpr for that
well but he is clearly accessing stuff, if he wants the size of the array, he can just constexpr the size of it
Avatar
Avatar
Jupstar ✪
well but he is clearly accessing stuff, if he wants the size of the array, he can just constexpr the size of it
hm, it wasn't that clear to me atleast
Avatar
yeah actually nvm
20:29
just dont do std::size here, just declare the array size
20:29
can put a constexpr inside the struct probs?
20:29
so he can access it
Avatar
Avatar
Learath2
I wonder why std::array::size() can't be static aswell actually, that would solve this and be sane
constexpr auto k = decltype(decltype(v_vec)::value_type::m_arr)::size(); if this was the case, that'd be so nice
Avatar
Avatar
Jupstar ✪
can put a constexpr inside the struct probs?
Hm, that could work actually
Avatar
mh no doesnt 😄
Avatar
anyway, the sizeof works too, so whatever
Avatar
@Learath2 @Chairn ez pz no problem c++ struct s{ std::array<int, 100> a; static constexpr std::size_t t = std::size(decltype(a)()); };
Avatar
do you actually need the static too?
Avatar
inside the struct yes
20:35
but should work outside of the struct too
Avatar
Avatar
Jupstar ✪
@Learath2 @Chairn ez pz no problem c++ struct s{ std::array<int, 100> a; static constexpr std::size_t t = std::size(decltype(a)()); };
uh that doesn't work? Can't use a temporary inside std::size, that's what it told me when i tried
Avatar
if its a constexpr why not
20:40
std::array constructor should be constexpr, but maybe only c++20 again xd
20:41
ah you probs using it on a datatype
20:41
maybe that datatype needs constexpr constructor too
Avatar
error: temporary of non-literal type 'CGraphics_Threaded::SQuadContainer::SQuad' in a constant expression
Avatar
yeah
20:43
SQuad constexpr constructor
20:43
gogog
Avatar
this branch is becoming a huge mess 😄
Avatar
^^
Avatar
i should split commits like Robyt does
20:44
i guess we're both extreme
Avatar
what is this branch doing exactly :o
Avatar
i bundle everything in a single commit, he breaks his pr in multiple small commits
Avatar
Avatar
Patiga
@Tater damn before I went away a week ago I opened your shadertoy page. now that I'm back that was the first page I have open and I'm absolutely amazed :D
Thanks :D
Avatar
Avatar
Voxel
what is this branch doing exactly :o
initialize everything everywhere
20:46
but it breaks the code right now (and im not sure, but im afraid it breaks protocol also...)
Avatar
Avatar
Chairn
initialize everything everywhere
is that even good btw?
20:46
that prevents catching logic errors that are caused if you didnt want a default 0 initialization
Avatar
some part of the code are literally waiting to be broken to be honest
Avatar
i imagine faster loading time
Avatar
yes but i wouldnt just blindly say initializzing everything to default is a MUST be good
Avatar
Avatar
Voxel
i imagine faster loading time
should actually be slower, but in my preliminary tests, it was actually faster, i dont know why and how (edited)
santatrollet 1
Avatar
Avatar
Jupstar ✪
yes but i wouldnt just blindly say initializzing everything to default is a MUST be good
yeah i agree
20:48
im kinda in machine mode, not thinking
Avatar
but anyway future coders could simply initialize values where its declared
20:48
struct a{ int i = 2 }
20:48
less error prone
20:48
;D
Avatar
Avatar
Jupstar ✪
but anyway future coders could simply initialize values where its declared
not even possible 🙂
Avatar
but currently we also have constructors, oninit, onconsoleinit, onchillerdragonsmodneedssomeinitinit
Avatar
because this auto declares constructor and can turn some classes into virtual...
20:49
which breaks all the mem_zero calls
20:49
i think i will revert all init and just fix the mem_zero, mem_copy and mem_comp calls
Avatar
Avatar
deen
what do you mean by focus it?
servelist is refreshing, when you switch tabs, but not when you come from ingome to server browser. is it worth to add a refresh there?
21:08
at least that's what i meant, that's the behavior for me, i'd expect to be the browser always up to date, when i focus it
21:09
coming from ingame, opening ingame browser, switching tabs, starting ddnet client, maybe even refreshing after a certain amount of time, when leaving the server browser open while afk or doing stuff (edited)
Avatar
sizeof(*(int *)nullptr) isn't UB, right? (edited)
Avatar
no idea, but i'd say it compiles and runs fine?
21:18
or does the standard require compiler to evaluate the expression inside sizeof, in that case it would segfault ? (edited)
Avatar
Avatar
heinrich5991
sizeof(*(int *)nullptr) isn't UB, right? (edited)
shouldn't be, evaluating that stmt is UB, but sizeof doesn't evaluate it's operand
21:28
well expression, not statement
Exported 158 message(s)