translation-unit 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

1

Solved

I have below tree: . ├── func1.c ├── func2.c ├── main.c ├── Makefile ├── override.c └── weak.h main.c invokes func1(). func1() invokes func2(). weak.h declares func2() as weak. override.c provide...
Ensample asked 7/8, 2021 at 3:48

1

I am wondering what exactly the difference between the following two declarations is if both are written in a single header file: inline thread_local MyClass obj1; // inline with thread_local thre...
Isosteric asked 10/7, 2019 at 22:54

3

Solved

in visual studio you can set different compiler options for individual cpp files. for example: under "code generation" we can enable basic runtime checks in debug mode. or we can change the floatin...

3

Example: Say I include in my precompiled header file: #include <vector> As a few instances of the vector, such as std::vector, std::vector etc are used often in my project, will it reduce ...
Hemolysis asked 28/7, 2017 at 9:40

4

Solved

Suppose I have two .cpp files file1.cpp and file2.cpp: // file1.cpp #include <iostream> inline void foo() { std::cout << "f1\n"; } void f1() { foo(); } and // file2.cpp #includ...
Kryska asked 2/5, 2017 at 11:7

2

Solved

If we have two .c files and a .h file: main.c sub.c sub.h, where main.c #include "sub.h" ... sub.c #include "sub.h" ... we can compile the program with, either i) gcc -o a.out main.c sub.c ...
Pleinair asked 29/1, 2017 at 23:38

2

Solved

So, I know static functions are functions that are local to the file. Thus, they can't be accessed from other files. Does this work for classes too? I've read a ton of controversy on how static cla...
Slipslop asked 22/11, 2016 at 23:35

1

Solved

Can someone explain the nature of this C++ compile error? I am dabbling in/learning about overloading the global operators new, delete, and their variants. I read a couple of articles on the subjec...
Locket asked 5/9, 2016 at 5:13

1

Solved

I couldn't find the difference between translation unit, compilation unit, object file, executable...At many places I've seen that one is used instead of other. I am aware that these files are gen...

1

Solved

From the following stackoverflow answer, the user says: It means that the variable is local to a translation unit (simply put, to a single source file), and cannot be accessed from outside it....

1

Solved

As far as I know, each template have different instances on each translation unit, and for my understanding a translation unit is roughly a cpp file. So, if I have a file named test.hpp with...
Heliotrope asked 31/3, 2015 at 11:14

1

I'm having some trouble understanding how the C++14 extension of the auto type-specifier described in N3638 can possibly be implemented, and what, exactly, is allowed. Specifically, one of the cha...
Paphos asked 2/1, 2015 at 18:1
1

© 2022 - 2024 — McMap. All rights reserved.