Skip to main content
Filter by
Sorted by
Tagged with
Advice
0 votes
7 replies
135 views

So I've been using this code for generating such statements following This Reddit post: #define LOOP(seq) END(A seq) #define BODY(x) int x; #define A(x) BODY(x) B #define B(x) BODY(x) A #define A_END #...
Doofus's user avatar
  • 3
0 votes
1 answer
78 views

<span class="SpellingError SCXO166867203 BCX8" style="margin:0px;padding:0px;background-repeat:repeat-x;background-position:left bottom;">bv</span><span class="...
Retroshift's user avatar
0 votes
0 answers
555 views

I’m currently using the Docling library in Python to extract text from PDF files. While it works well for retrieving visible text, I’ve noticed an issue with hyperlinks. Specifically, the library only ...
Akshata's user avatar
  • 29
2 votes
1 answer
74 views

For example, if I create file jopa.erl with this code inside ... -module(jopa). ...everything compiles without errors However, if I put this code inside jopa.erl ... -module(lol). and try to compile....
Kitaram's user avatar
  • 31
12 votes
7 answers
2k views

I am developing a C++17 framework that has optional third-party dependencies and I'd like to construct an std::array that contains the names of the available dependencies. The CMake file sets ...
Charlie Vanaret - the Uno guy's user avatar
0 votes
0 answers
69 views

I am working on some proof of concepts for ML and want to try an unusual scaling method. I would like to group my data and then "scale" it and apply a binarize to that data. Basically I ...
Tim Romero's user avatar
3 votes
0 answers
59 views

Is there a way to have the GNU assembly process a source file that contains macros, expand them, and then output the expanded equivalent code in a form that could be assembled by as? Basically, I'm ...
Bri Bri's user avatar
  • 1,992
3 votes
1 answer
161 views

The C++ macro __FILE__ typically includes the full path (with many compilers). For my tracing, I want just the file name, not the full path. Is there a built-in macro for this in any version of C++ or ...
Samuel Wenker's user avatar
4 votes
2 answers
227 views

I'm studying how tokenization works in C programming, especially for examination purposes. I want to understand how many tokens are present in the following C code and how preprocessor directives are ...
rayhanrjt's user avatar
0 votes
0 answers
79 views

my wxWidgets application has multiple C++ projects (one executable and all the other static libraries). I am using Visual Studio 2022 with a solution having Debug and Release configurations only for ...
Kérdezösködő Indián's user avatar
1 vote
1 answer
169 views

By default, clang defines some SIMD related macros: ~ $ 0 clang++ -dM -E -x c /dev/null | grep -i sse #define __SSE2_MATH__ 1 #define __SSE2__ 1 #define __SSE_MATH__ 1 #define __SSE__ 1 These can be ...
Dorian's user avatar
  • 632
2 votes
1 answer
115 views

I'm trying to do the following: [Code] #define TextMacro "Hello2" procedure InitializeWizard(); var Mode: Integer; begin #ifdef TextMacro #if TextMacro == "Hello" ...
qloq's user avatar
  • 1,335
2 votes
2 answers
91 views

I have a header file that introduces a macro that declares a Stack structure and some asociated functions that work with that struct. Header file (Stack.h) content is shown below: #ifndef STACK_H #...
Andrey Dorofeev's user avatar
7 votes
1 answer
159 views

I am trying to document a header file which has different "overloads" when parsed by C or C++. #ifdef __cplusplus /// myfuncA void myfuncA(); /// MYMACRO_A #define ...
Anti Earth's user avatar
  • 4,941
3 votes
2 answers
125 views

We know that main() is the entry point of a C program. But what happens if we define main as a macro, like this? #define main something_else Will the program compile and run correctly? How do ...
Alphin Thomas's user avatar
2 votes
3 answers
113 views

The following code compiles without error: //#define FOO #if FOO sdjlfs #endif int main(){ return 0; } although I would expect it to fail at line 2, because the following doesn't compile (...
mo FEAR's user avatar
  • 707
3 votes
1 answer
161 views

For example #define BEGIN_RAW R"( #define END_RAW )" const char* foo = BEGIN_RAW this is a raw string END_RAW; This doesn't work. It looks like the preprocessor itself resolves the ...
terriblememory's user avatar
1 vote
2 answers
140 views

I have a list of functions generated in a Makefile and dumped into a file that looks something like: DEF(foo) DEF(bar) DEF(baz) The intent is that this file will be used like so to define a list of ...
shoosh's user avatar
  • 79.4k
1 vote
1 answer
40 views

I trained a CNN for emotion recognition and used two different transformation pipelines for image preprocessing: Simple Transformation: TRANSFORM = transforms.Compose([ transforms.Resize((64, 64)),...
Sk8's user avatar
  • 13
1 vote
2 answers
174 views

I recently learned how the c compiler actually works and there is a specific configuration that i do not understand : When I write a header it looks like this: #ifndef HEADERNAME #define HEADERNAME //...
Waleen _'s user avatar
0 votes
2 answers
158 views

Background I have some macros of the form ATTR(XXX(...)). ATTR processes XXX into a macro ATTR_IMPL_XXX(...), and XXX can have a variable number of arguments (these variadic args are just passed to ...
Anon's user avatar
  • 381
0 votes
0 answers
53 views

In z88dk-z80asm I want to include a binary file using a string literal, where a part of the file name is passed as a command line variable/symbol (-D) to the compiler: binary "...
Markus Rautopuro's user avatar
0 votes
0 answers
143 views

Can I use the token-pasting operator ## in the following way: #define NameIs 0xFFFF #define PASTE NameIs #define foo(text) My##text##Andrey foo(PASTE); ...and don't get -> "MyPASTEAndrey&...
qsivey's user avatar
  • 1
1 vote
0 answers
31 views

I am using visual studio 2019. I have a project A (dll) depending on a project B (static library). So when building A, it builds indeed B first. So I would like to have a preprocessor defined when ...
tony_merguez's user avatar
4 votes
1 answer
283 views

I'm migrating my codebase from C17 to C23 on ARM-GCC and would like to be able to print the evaluation of constexpr calculations at compile-time for debugging purposes. In C17, I used #pragma message ...
w00t's user avatar
  • 143
1 vote
1 answer
221 views

If I don't know where I might find the xyzzy header, should I write (e.g.): #if __has_include("xyzzy") # include "xyzzy" #elif __has_include(<xyzzy>) # include <xyzzy> #...
David Partridge's user avatar
1 vote
1 answer
80 views

I have the following Haskell file that contains a CPP macro. #define FOO( x, y ) x ++ y foo = FOO("a", "b" ++ "c") bar = 1 When I call cpphs on this ...
Jan Christiansen's user avatar
3 votes
1 answer
63 views

I'm running into an issue with a macro that is generated from an environment variable in platform.io: -D SXM_VERSION=\"${sysenv.SXM_VERSION}\" As you can see SXM_VERSION forced to start and ...
Forivin's user avatar
  • 15.8k
0 votes
2 answers
166 views

I'm trying to understand why two mutually included headers (each header including the other) doesn't work the way you might expect. I was wondering if my reasoning is correct: If you have FooHeader.h: ...
Zebrafish's user avatar
  • 16.3k
0 votes
1 answer
113 views

I would like to see my esp-idf code after preprocessing (see which code inside of #ifdef will be compiled). I tried adding "add_compile_optins(-E)" in my main CMake file, but the build ...
bakar bakar's user avatar
1 vote
0 answers
124 views

I think that the benefits of data immutability outweigh the inconvenience of the implicit mut qualifier. That's why in my opinion it should be the default. I know that some functional languages ...
yurich's user avatar
  • 157
0 votes
0 answers
199 views

Because I wanted to learn more about the preprocessor, I enabled "Preprocess to a file" for my project (project properties, C/C++, preprocessor), so it looked like this: However, at some ...
Thomas Weller's user avatar
4 votes
2 answers
161 views

Given the following code: #include <limits> #include <Windows.h> int main() { std::numeric_limits<double>::max(); } I can avoid the preprocessor macro expansion of max() from ...
Thomas Weller's user avatar
0 votes
0 answers
56 views

My actual use case if for C++. I'm trying to reduce the amount of typing I need to do while explicitly instantiating a template. E.g., template <int N> void myFunc(std::array<float, N> ...
stuyguy's user avatar
  • 257
0 votes
2 answers
170 views

#include <iostream> using namespace std; const string getFileNameAsVarName(string filename, int lineNo) { string s = ""; for (char c : filename) { if (c > 'a' && ...
Guichi's user avatar
  • 2,353
0 votes
1 answer
97 views

I am writing a c++ library where I deal with plenty of templated classes and free functions . Example (header + source file containing a free function): #ifndef MY_FUNCTION_HPP #define MY_FUNCTION_HPP ...
Mathieu's user avatar
  • 332
2 votes
1 answer
73 views

I am developing a 'C' macro-expander with Visual Studio 2022 & Boost.Wave (through vcpkg). I based the application on the advanced_hooks sample that ships with boost. The application works ...
johnco3's user avatar
  • 2,661
0 votes
2 answers
168 views

I have a file with hundreds of preprocessor macros of the form... #define foo (bar) Is there an easy one-line way to define each one only if it doesn't already exist? For a single macro once could do ...
user4574's user avatar
  • 416
0 votes
1 answer
133 views

Yesterday at work, my colleague claimed that preprocessor macros were slower than writing variables and functions manually. The context is that we have a class in which member variables are sometimes ...
Ccre's user avatar
  • 3
1 vote
1 answer
53 views

I'm attempting to remove bi-grams that are created by TfidfVectorizer. I'm using text.TfidfVectorizer so that I can use my own preprocessor function. Test strings and preprocessor function: doc2 = ['...
TER's user avatar
  • 119
1 vote
1 answer
43 views

I have a question regarding compilation with GCC. I have a slight confusion that I believe I've figured out but would like confirmation on. In the first compilation step, preprocessing (cpp) organizes ...
DLR's user avatar
  • 11
-2 votes
1 answer
174 views

#define BLUR 2 #define LEN (2 * BLUR + 1) * (2 * BLUR + 1) using namespace std; int main() { cout << 50 / LEN; // result is 50 } the expected result is 2 but it's 50. I try another numbers ...
reza sohrabi's user avatar
1 vote
1 answer
126 views

Any ideas how to remove comments from the scala code so that: Nested multi line or single line comments are removed. Comments inside string literals are not removed. Code can have single and triple ...
user4955663's user avatar
  • 1,101
0 votes
1 answer
84 views

I am writing some Python code that includes functions with two sets of parameters. The first set of parameters will be different every single time the function is called. The second set of parameters ...
Jack MacArthur's user avatar
2 votes
2 answers
164 views

I am making a library in C and writing internal documentation for it using Doxygen 1.9.4. I have a following header, included both from library source (in this case LIBRARY_SOURCE is defined) and from ...
Kirill's user avatar
  • 21
3 votes
2 answers
108 views

I have a C macro that concatenates bits together in order to resolve to other macros. I'll demonstrate using an admittedly pointless macro called MULT which multiplies two numbers. So long as I pass ...
Bri Bri's user avatar
  • 1,992
0 votes
1 answer
30 views

I am trying to use JSR223 preprocessor to extract token from login and using it in other thread group of my test plan, but i am not getting it , i tried to add debugger , but token is not present in, ...
mayuri's user avatar
  • 129
1 vote
1 answer
102 views

With these #defines without arguments #define r 31 #define UMASK (0xffffffffUL<<r) #define LMASK (0xffffffffUL ^ UMASK) will UMASK be identical to (0xffffffffUL<<31) and LMASK be ...
robert bristow-johnson's user avatar
1 vote
1 answer
270 views

I am using clang-format to format my C++ code. However, I want to align preprocessor directives (including the # sign) with the surrounding code blocks. Currently, clang-format aligns the directives ...
Mahdi Ghasemi's user avatar
0 votes
1 answer
310 views

I have multiple target created in my project. Now I'm planing to add a string UUID to all the targets GCC_PREPROCESSOR_DEFINITIONS aka preprocessor macro. I'll add this to Alpha, Beta, Lite & Prod....
mefahimrahman's user avatar

1
2 3 4 5
39