Mouad
what is the most hard concept to learn in C++?
Danya🔥
Everything is hard
VD
what is the most hard concept to learn in C++?
Templates is usually hard for most people especially the compile time rules, concepts and also the use of constexpr, consteval and constinit and the usecases around them. The other things like ranges are pretty easy to understand unless you are into extending them for your own data structures which requires a lot of effort on your side. Modules are an entirely different beast that no one understands completely yet
VD
I don't care
Good luck with staying in this group then.
VD
tHANX
You are in a way lucky that the woman who drafted the rules is no longer in this group. She was a hothead who instantly banned anyone who didn't follow the rules. So Danya was just being polite
Tanish
Bro , dont go for offchat , so please shut up
Saqo
Hi guys
Saqo
What is different between constexpr consteval and constinit
Danya🔥
What is different between constexpr consteval and constinit
Have you tried reading cppreference on the matter?
sajad
Hi guys first sry for my bad english why this code work ? uintptr_t ModuleBase = (uintptr_t)GetModuleHandle(L"server.dll"); uintptr_t EntList = *(uintptr_t*)(ModuleBase + 0x4A1670); 👇 uintptr_t cssBot_1 = *(uintptr_t*)(cssBot + 0x24); but this ? not for (int i = 1; i < 12; i++) { uintptr_t ent = *(uintptr_t*)(EntList + 0x14 + (i * 10)); }
borealis
multiply by 0x10 not 10
sajad
multiply by 0x10 not 10
🤦‍♂️😐 tnx
Leovan
Everything is hard
Everything is easy, as for me hard to don't forget what you learned 😁
Brian
/start@MissRose_bot
Rose
/start@MissRose_bot
Heya :) PM me if you have any questions on how to use me!
D
Undefined Behavior
which is sometimes actually platform specific behavior
Pavel
which is sometimes actually platform specific behavior
Well, there's unspecified behavior which is platform specific
Pavel
Undefined behavior may be platform specific today, and explode something when you update your compiler tomorrow (but technically it is already "exploded" today)
D
yep, that's what i'm talking about. For example, update interfaces by appending new virtual functions and don't recompile everything related - you get UB. But according to COM interfaces everything will still work That's my favorite PS behaviour
Skarn
Skarn
E.g. type punning is allowed in GCC through a union, while being UB in the standard. And it is stated so in their documentation.
Pavel
E.g. type punning is allowed in GCC through a union, while being UB in the standard. And it is stated so in their documentation.
Oh, this is interesting, so you can rely on these cases of UB as long as you make sure you always use that compiler?
Skarn
Oh, this is interesting, so you can rely on these cases of UB as long as you make sure you always use that compiler?
Yes. Keep in mind that there are some other cases of "compiler defined" behavior for some cases of UB, but they are not documented. You can't rely on these. For example, the same union thing works perfectly fine in MSVC as well, they even use it in their stdlib code, but they never explicitly documented that you can rely on this.
Skarn
GCC however did
D
I just can't imagine how else union can be implemented so that you aren't able to use type punning. The whole point of it is using the same memory space, so why not?
Pavel
I just can't imagine how else union can be implemented so that you aren't able to use type punning. The whole point of it is using the same memory space, so why not?
You can use unions to store values of a type that is known only at runtime. E.g. some data structures can store either data or pointer to the next element (and store information about what is stored there outside of the element somehow)
欣婷
Excuse me, I have a function int readLine(char **args, uint size), I call readLine(buf, MAXARG) this way, how can I change the value of buf by args
harmony5 🇺🇳 ⌤
What do you mean? Cc the compiler?
klimi
What's cpanel? Are you talking about PHP?
Rose
Reported د/ عبدالرحمن الوجيه [6100627655] to admins.​​​​​​​​​​​
Never Spam Bot
Setting requested by Ighor July set to true
Rose
Reported د/ عبدالرحمن الوجيه [6100627655] to admins.​​​​​​​​​​​
We1Kin
guys, does anyone know the environmentVariables in cmake-kits.json will appear in the compile-command.json or not?
We1Kin
I set some environmentVariables in cmake-kit.json like this: { "name": "Clang 17.0.6 arm64-apple-darwin23.4.0", "compilers": { "C": "/opt/homebrew/opt/llvm/bin/clang", "CXX": "/opt/homebrew/opt/llvm/bin/clang++" }, "environmentVariables": { "LDFLAGS": "-L/opt/homebrew/opt/llvm/lib", "CPPFLAGS": "-I/opt/homebrew/opt/llvm/include" }, "isTrusted": true },
Danya🔥
Lol wtf
Danya🔥
Fuck this bot is stupid
We1Kin
i just copy the compile-command.json context.....
Danya🔥
i just copy the compile-command.json context.....
Anyways the answer is that env variables are not passed through command line
We1Kin
Anyways the answer is that env variables are not passed through command line
fine, thx, and another question: how can I ensure that my environment variables have been correctly activated?
Ighor
Lol wtf
sorry, fixed
Danya🔥
What are you trying to do?
harmony5 🇺🇳 ⌤
fine, thx, and another question: how can I ensure that my environment variables have been correctly activated?
What do you mean by activated, do you mean if they've been set? You could just check their value
Rose
User Brian has 1/2 warnings; be careful! Reason: assignment
Danya🔥
What do you mean by activated, do you mean if they've been set? You could just check their value
Well these values are set only for the compiler invocations by cmake
Rose
User Teja has 1/2 warnings; be careful! Reason: spam
Rose
Purge complete.
At
i projects to practice on it
At
want*
Laopigo
Am I understanding correctly that the value of c is implementation defined? uintptr_t a = some_value; char *b = a; uintptr_t c = b;
Cesar
https://www.phoronix.com/news/x86-simd-sort-5.0
Manav
I was just hoping for it
can you share your reasons? It'll help us figure out what you're missing, etc.
Laopigo
can you share your reasons? It'll help us figure out what you're missing, etc.
I thought that converting uintptr_t to pointer is a reinterpretation, as is the case with converting pointer to uintptr_t
Manav
I thought that converting uintptr_t to pointer is a reinterpretation, as is the case with converting pointer to uintptr_t
you're right but not for the correct reasons. a pointer to pointer conversion can be undefined if the converted value doesn't match the alignment.
Manav
so in that case it's not implementation defined but it can have undefined behaviour if it's not aligned
Manav
uintptr_t c = b; this one that is
Manav
char has alignment of 1, defined by C++ standard because of it's size, so the first cast is fine
Manav
you're right but not for the correct reasons. a pointer to pointer conversion can be undefined if the converted value doesn't match the alignment.
Any pointer to object can be cast to any other pointer to object. If the value is not correctly aligned for the target type, the behavior is undefined. From cppreference
Laopigo
Thanks
Never Spam Bot
Eli Gagnon sent multiple messages that looks like a spam. If they send more spam - like messages, they will be muted. Only admins can unmute them. Spam deleted in this group: 405 See spam? Quote it and send /spam
VD
uintptr_t c = b; this one that is
Is it really Undefined Behavior though? I checked the standards and the standards clearly mention that any void* pointer can be converted to uintptr_t and back. So if that applies to a void* pointer to a double then it should apply directly to the double* pointer as well. So I don't know what the compiler would do underneath that would make b = (uintptr_t(void*(&a))); c = double*(void*(b)); legal but b = uintptr_t(&a); c = double*(b); illegal where a is a double say. I am not sure about it though
VD
AFAIK, conversions to and from void*, intptr_t and uintptr_t don't care about alignment. That is why the standard specifically says that you must convert back to the same original type after casting to one of these types.
Ya deway
guys absolutely have to help me. The assembler code of the RtlInitUTF8String function contains only a jmp instruction at another address. The total size of the function is 5 bytes. I got from my kernel code a pointer to the RtlInitUTF8String function and checking it is correct. But once I parse the 4 bytes after the function pointer I don't find any jmp instruction or associated value (I also tried parsing the first byte of the address, which should be the jmp instruction)
Ya deway
what bytes do you get from the pointer you got from your kernel code?
Maybe I understood the problem, the 32bit conversion was wrong
Ya deway
what bytes do you get from the pointer you got from your kernel code?
Address + 5 byte: 48 83 EC 28 E8 /// Start Address: FFFFF80450B83A80
borealis
.text:00000001405A5150 public RtlInitUTF8String .text:00000001405A5150 RtlInitUTF8String proc near ; CODE XREF: PiGetDefaultMessageString+E55A3↓p .text:00000001405A5150 ; DATA XREF: .pdata:0000000140102E0C↑o .text:00000001405A5150 48 83 EC 28 sub rsp, 28h .text:00000001405A5154 E8 F7 E6 D4 FF call RtlInitAnsiString .text:00000001405A5159 48 83 C4 28 add rsp, 28h .text:00000001405A515D C3 retn .text:00000001405A515D ; --------------------------------------------------------------------------- .text:00000001405A515E CC db 0CCh
borealis
you are in kernel mode thus you should look at ntoskrnl.exe, not ntdll.dll
Ya deway
Damn, thanks sir
borealis
if you must work with the instance of ntdll.dll loaded to the address space of a user mode program, then you should traverse the memory of that user space program and find ntdll.dll there. with your current approach you were looking at the kernel mode memory space
Ya deway
I thought ntdll was kernel mode, im developing using wdk and ntddk.h library
borealis
no, ntdll is used to interface with the kernel mode from user mode. it's only loaded to user mode programs