storage-duration Questions

3

Solved

How can static local variable shared along different translation unit? I know that "static" specifies internal linkage. In case of "static" member function having same address i...
Cherub asked 30/4, 2023 at 10:33

2

I know that Google Cloud storage has 4 options of storage and each options has a different of "Minimum storage duration" https://cloud.google.com/storage/docs/lifecycle?hl=vi Standard Sto...
Inversion asked 20/10, 2020 at 9:44

2

Solved

I know the variables in function are using stack space. When function exit, the space are freed. That's why we should declare the pointer variable as static in function. However, I found that the c...
Thorsten asked 5/5, 2022 at 9:44

3

Solved

In C, the code char *c = "Hello world!"; stores Hello world!\0 in rodata and initializes c with a pointer to it. How can I do this with something other than a string? Specifically, I am trying ...
Blastosphere asked 26/9, 2019 at 1:17

0

I would like to make sure that an argument given to a function points to (or references to) an object which has static storage duration class. The solution needs to work with C++11 without compile...
Insecurity asked 18/8, 2019 at 10:8

2

Solved

Does a reference have a storage location or is it just an alias for another location? Does this differ by C++ revision or is it consistent with all versions of C++? And if a reference has a storage...

3

Solved

As far as I know , a string literal like "Hello" is considered a char* in C and a const char* in C++ and for both languages the string literals are stored in read-only memory.(please correct me if...
Newmarket asked 12/3, 2015 at 11:21

3

Solved

I have a question regarding the answer in this question but I can not comment on it because I have less than 50 rep. I was wondering in the answer foo() is being called multiple times and the sta...
Lappet asked 30/3, 2017 at 5:42

1

Solved

If a C++ constructor for an object with static-storage duration does not initialize a member, is that required to preserve the prior zero-initialization, or does it leave the member with an indeter...
Elongate asked 31/10, 2015 at 20:17

1

Solved

Quick setup: I want to pass strings around in my program as a pointer and a size. I have a String class and a user-defined literal for constructing literal Strings: struct String { const char *ptr...
Satirist asked 18/9, 2015 at 12:29

4

Solved

Why does default initialization of static data member not occur? In the following example struct data_member { data_member(){ cout << "data_member\n"; } ~data_member(){ cout << "~dat...
Leonelleonelle asked 10/7, 2014 at 17:1
1

© 2022 - 2024 — McMap. All rights reserved.