This question already has answers here:
How can I store a value at a specific location in the memory?
(4 answers)
Closed 8 years ago.
Is is possible to directly store data into a memory location using C ?
To be more specific,
What if i want to store an integer data to a memory location starting from 00100000. Is it possible ?
Yes it is. You can do this: int*ptr = 00100000; And then do *(ptr) = 10; I highly recommend you don't do this however.
Related
This question already has answers here:
Explain the concept of a stack frame in a nutshell
(6 answers)
What is an application binary interface (ABI)?
(17 answers)
Closed 2 years ago.
Speaking of the order of parameters, return addresses, local variables and other block statements, how are they pushed inside the stack frame and how that particular order works? I'm having a bit of trouble understanding this concept.
This question already has answers here:
When should SecureZeroMemory() be used?
(2 answers)
Is free() zeroing out memory?
(7 answers)
Why doesn't free() zero out the memory prior to releasing it?
(17 answers)
Does using SecureZeroMemory() really help to make the application more secure?
(5 answers)
Closed 5 years ago.
What's the best way to clear out this allocated memory?
Is free/=NULL all that's needed
Does SecureZeroMemory before doing a free/=NULL add to the security of the code?
Or, is adding SecureZeroMemory overkill?
Here's my code:
DWORD tLen = 128;
BYTE *pbData = (BYTE *)malloc(tLen);
memcpy(pbData, chBuffer, tLen);
// ...work done here...
// Clear it
SecureZeroMemory(pbData, tLen);
free(pbData);pbData=NULL;
Thanks!
EDIT: This question is not a duplicate of the question some people have said it is. It is not asking when to use SecureZeroMemory, but the best practice when used with free/=NULL.
It depends what your program is doing. If someone else can look at a buffer of freed memory, is that a concern to you? If the memory contains bank account details, I'd say that it is. If it contains settings for a video game, maybe not (depending on how determined your users are to cheat).
Bit generally it doesn't do any harm to shred memory before freeing it.
This question already has answers here:
what is meant by normalization in huge pointers
(3 answers)
Closed 9 years ago.
Actually i was studying about huge and far pointers.
I come to know huge pointers are by default in normalized form.
I want to know how can we normalize any pointer?
The huge pointer and far pointer are old concept which live in 16-bit
DOS time. You can search something about DOS programming for more
detail about them.
In 8086 programming (MS DOS), a far pointer is normalized if its offset part is between 0 and 15 (0xF).
This question already has answers here:
Where are static variables stored in C and C++?
(16 answers)
Closed 9 years ago.
I know global constant will be stored in "Read Only" section. But What section of memory are static local constants stored in?
It depends on the compiler and the platform you're compiling for. They may be placed on the bottom of the stack, in the data segment of the primary thread, or simply on the heap, or even somewhere else.
This question already has answers here:
Iterator invalidation rules for C++ containers
(6 answers)
Closed 8 years ago.
For instance:
thrust::device_vector<float> vec(...);
thrust::device_vector<float>::iterator i = vec.begin();
vec.resize(...); // vec may get reallocated and moved in memory here
Now, has vec.begin() also updated and still point validly to the start of vec?
Upon resizing, if the vector originally did not have enough space, your iterator will be invalidated, so you'd have to recall vec.begin() to get a new, valid iterator.