Odex
Odex
CC#
Created by Odex on 2/9/2025 in #help
`readonly` struct, `in` modifier and defensive copies
Again, my priority is performance and avoid as many useless copies as possible
31 replies
CC#
Created by Odex on 2/9/2025 in #help
`readonly` struct, `in` modifier and defensive copies
So do you recommend me removing the in modifier when passing arrays (even if it's an array of struct)?
31 replies
CC#
Created by Odex on 2/9/2025 in #help
`readonly` struct, `in` modifier and defensive copies
On second thought, I don't need the in modifier at all for arrays of structs, since they're still passed by reference because arrays are allocated in the heap, right?
31 replies
CC#
Created by Odex on 2/9/2025 in #help
`readonly` struct, `in` modifier and defensive copies
No description
31 replies
CC#
Created by Odex on 2/9/2025 in #help
`readonly` struct, `in` modifier and defensive copies
Thanks dude! I couldn't find an exact explanation online 👍
31 replies
CC#
Created by Odex on 2/9/2025 in #help
`readonly` struct, `in` modifier and defensive copies
So it's safe to access fields when passing a struct with in modifier, since I can't change them (and reading won't mutate) And it's also safe to access methods as long as they are readonly
31 replies
CC#
Created by Odex on 2/9/2025 in #help
`readonly` struct, `in` modifier and defensive copies
OH! Now everything's clear
31 replies
CC#
Created by Odex on 2/9/2025 in #help
`readonly` struct, `in` modifier and defensive copies
what about fields?
31 replies
CC#
Created by Odex on 2/9/2025 in #help
`readonly` struct, `in` modifier and defensive copies
As far as I know the compiler will create defensive copies whenver I'm trying to access mutable data What if I have private fields and use readonly getter for that? Will the compiler still create defensive copies?
31 replies
CC#
Created by Odex on 5/13/2024 in #help
How to marshall pointer to array inside struct
let's test
17 replies
CC#
Created by Odex on 5/13/2024 in #help
How to marshall pointer to array inside struct
No description
17 replies
CC#
Created by Odex on 5/13/2024 in #help
How to marshall pointer to array inside struct
like the span constructor takes length as a second parameter i remember
17 replies
CC#
Created by Odex on 5/13/2024 in #help
How to marshall pointer to array inside struct
on second thought, do I need to know Rectangle* Recs size in order to make a managed array/span?
17 replies
CC#
Created by Odex on 5/13/2024 in #help
How to marshall pointer to array inside struct
17 replies
CC#
Created by Odex on 5/13/2024 in #help
How to marshall pointer to array inside struct
I'll try
17 replies
CC#
Created by Odex on 5/13/2024 in #help
How to marshall pointer to array inside struct
hmm
17 replies
CC#
Created by Odex on 5/13/2024 in #help
How to marshall pointer to array inside struct
ain't much useful copy-pasting a link with no further explanatory btw
17 replies
CC#
Created by Odex on 5/13/2024 in #help
How to marshall pointer to array inside struct
even if I made a custom marshaller, will my code actually compile? I think it doesn't like the type being an array at all.
17 replies
CC#
Created by Timinator on 3/26/2023 in #help
❔ PInvoke, Reflection or winapi for loading a DLL?
I still have no clue what you're trying to do with your parser, why complicate your life so much? If you want to share the same results across multiple languages, why don't you build a standalone parser which writes your desired data into a json or such files
186 replies
CC#
Created by Timinator on 3/26/2023 in #help
❔ PInvoke, Reflection or winapi for loading a DLL?
I didn't know that was a thing
186 replies