News for hackers. Stuff that matters.
Re:Reading the NSA’s codebase: LemonGraph review by posterboy on Friday August 10, 2018 @01:48PM (#17735350)
where's the difference if you put in the numbers by hand? Which numbers do you put in to avoid mentioning the size of the type?
Re:Reading the NSA’s codebase: LemonGraph review by kevin_thibedeau on Friday August 10, 2018 @03:03PM (#17735934)
You just feed sizeof the instance of the object you're allocating memory for. That entails funky pseudo-dereferences for pointers so the compiler doesn't give you the size of a pointer. It will look up the object's type and requisite size to fill in the argument to malloc(). If the object in question has an unknown type (maybe all you've got is a void *) then you will have to provide the size by other means.