static-allocation Questions

5

In C, on a small embedded system, is there any reason not to do the following? const char * filter_something(const char * original, const int max_length) { static char buffer[BUFFER_SIZE]; // Che...
Smilax asked 1/7, 2022 at 15:6

2

Solved

I want to create a struct in swift that has a small fixed number of values (say 16 floats) as instance data. It is required that this struct not store these values on the heap, so that the address ...
Catullus asked 11/7, 2016 at 3:58

1

I'm trying to statically allocate some structures, each containing two members: a pointer to an array of structures, and the size of that array. Here's a working version of the code: #define ARRA...
Matador asked 29/11, 2016 at 16:58

2

Solved

Is std::array<int,10> (without myself using new) guaranteed to be allocated in the stack rather then the heap by the C++-Standard? To be clear, I do not mean new std::array<int, 10>. I...

3

Solved

Why do Objective-c objects have to be dynamically allocated? Why do I have to make it a pointer to an object, unlike in C++ I can create them on stack? Thanks.

4

Solved

This is from a small library that I found online: const char* GetHandStateBrief(const PostFlopState* state) { static std::ostringstream out; // ... rest of the function ... return out.str().c...
Hydroxy asked 17/4, 2010 at 4:3
1

© 2022 - 2024 — McMap. All rights reserved.