 Okay, so yeah, that's me My talk is gonna be short ish basically is saying yeah, what he said Crazy it's a code checker. It's a clang plug-in. It's a crazy replacement I don't know if you guys remember we had something called crazy back then while we still have it It's some crazy Parallel scripts that try to understand the code until you're doing things wrong That's obvious obviously doesn't really work because you know Parallel and C++ and whatever So using clang as a plug-in is much better because it can actually understand the code It's a crazy project. So it's hosted on on our git repositories It's mostly done by Sergio Martins and by mostly I mean like 90% of the code I checked the code commits yesterday and he had like 200 and then the next guy had 10 and then I had nine so yeah, it's basically hidden but whatever So what does it check? Before what the check it has like four levels of checks called level zero one two and three Those levels are how stable the check is right? So basically level zero is mostly like it's always correct What does it tell you to fix level one is like 99% of the time is correct And then the others is like you should not trust it very much You could you should trust it, but just check right not not be blind about it It's also magical because sometimes it actually knows how to fix your code So it it will like rewrite your C++ right it's like your code is wrong and I fix it It's like good. I don't need to do anything I mean sometimes like the compiler could do that right like it says you forgot a semi-colon It's like just add it, you know, I mean you should be smart enough to do it anyhow So I'm going to do some Examples no, sorry first how to use it It's not really very packaged or I couldn't actually find any distribution that has a package for it So you'll have to compile it sometimes it's a bit tricky because distributions package the Clang and LLVM Libraries in a not very good way. So yeah, I mean it works, but sometimes you have to fiddle a bit with it Then it's very easy. You just tell CMake to use crazy as a compiler. Obviously you add it to your path or otherwise you put like the whole path over there and it will work And then as I said There's those levels by default level zero on level one are enabled. So the warnings you will get are mostly good if you want to enable Checks selectively you can either write them by name There's a there's a very nice man page that explains the names of every check So you can just go there and check the names or just go by level So say I want level zero and the check no QM. Oh, whatever. Yeah Examples so it does Tell you if you are trying to do a new style connect with something that isn't actually a signal, right? So you for example you pass us a lot as the second parameter that Would compile because you know, it's just a function that the cure that the connect is Trying to figure out but then when you run it you will never emit a slot, right? Because it's not a signal so it will fail then it has a few of Performance thingies. So if you do set to least zero then that's slow Because it has to convert the set to a least and then you get the first one Well, you could just do set cons first and blah blah blah blah, right? It's There's lots of checks that are about Minor things but when you fix all those minor things it really adds up Like it saves for example the key color one, right? I mean yeah, it's not that bad Right, but if you create lots of like that needs to create a string like a car pointer That will create a string that will create the key color and then you have to destroy the key string and your memory is Broken because you allocated like two bytes that are not being able to be reused again So sometimes you get a fragmentation. It also warns you about you using key enums The new nice keyword is Q enum without DS that does more magical things So you need to use that one instead of the other one It does tell you not to use Q file name Exists because there's a Q file info axis. Sorry that capital letter is messed because I Libre office does auto formatting and you know, you should use the static version which for some reason is faster There also weren't like there's a news a very nice one it warns you about when you have a Value that you never use and it's a class right like the compiler will warn you if you have an integer And you never use the integer But the compiler can't warn you if you have a key string and you never use the key string because the compiler doesn't know if the key string constructor does Magic things right, but we actually know that the key string constructor and the sector don't do anything So if you have key string s and never use the key string s crazy will will warn you about That one that's based on a white list So it's it's not it's not very smart It's just a white list that goes over your code and and checks if you have if you need to Stop using it or not as before with the value. So if you do Q that could kill it all Set values. That's that's very slow because needs to convert the set to a list and then delete it Q that all knows how to do that with a for each. So it's faster It will warn you if you have classes with key objects that don't have the key object macro Which also it's interesting because you can do all the magic with a meta object and whatnot There's a never-ending discussion about how evil Q-list is and you shouldn't be using it, right? So it also warns you about it. I don't know most of the times you don't really care, but you will get a warning And that's it. My talk is just this I encourage you to try it Most of the times you will get huge warnings and it's like meh It's not really that important, but if you if you go through them Slowly it I think actually it makes sense to to fix most of these little zero and level one level two. It's a bit meh There's also a nice Example that I didn't add here, which is the Q string one It gives you like this, you know, like there's this Q string literal that does black magic and doesn't do allocations when you when you create it It will tell you to use it. It will try to use it We when I was working at Canonical on the went to phone We tried that and it really helped with the memory fragmentation We were having like we were creating lots of strings all the time and deleting the Q strings And it did really reduce memory usage. So give it a go. Maybe it helps your project and That's basically it any what any question Well on arts you can find it in the arts user repository Okay, so it is there if you're using arts and also if you have any Kd project that uses extra scenic modules When you build if you set your compiler to clang You can enable an option that is used crazy and it does already all the magic for you So, right, you don't really need to do that. There's another You install it from if you are using arts, it's in five minutes. You can run it on your project So use arch or not Right, I'll repeat the question. He asked if there is any work to enable it on the CI system. I Don't know it shouldn't be very hard Because it's just another compiler, right? Do you know why it's not packaged for most so I think it's not packaged because there hasn't been actually a Release like a terrible Maybe there is I don't know. I think there is not so like if you don't give people turbos They usually don't package them. It's it's it's it's a reasonable expectation. So I have heard you know something about doing releases Oh, yeah, but I don't know. I'm here talking about something else. I'll talk to Sergio It should be easily fixable if if he hasn't done a release we'll we'll make to the one Question Okay, then I have a question. It's stupid one But does Clazy actually compile the code after checking it because otherwise C make would error out with the Clazy cannot actually compile executables if you say the CXX compiler is Clazy so again So does Clazy actually compile the code after running the checks because it Like it gives like the errors are on compile time So it's basically a compiler, right? So like as you would get the warning Yeah, the compiler will give you a compiler warning. You'll forget the Clazy warnings, right? Because if you set the C make CXX compiler is Clazy and it doesn't actually compile the code at the end of it Then C make would complain that it's fine. It's it will give you at the end. You will get a proper binary and whatnot. Okay, cool Okay, then I guess that's it. Thanks Albert great talk