Questions tagged [precompiler]

42 questions
238
votes
7 answers

Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio

Is there a way to set by default for all projects removing the precompiler secure warnings that come up when using functions like scanf(). I found that you can do it by adding a line in the project option or a #define _CRT_SECURE_NO_WARNINGS in the…
Juan Martinez
  • 2,520
  • 2
  • 16
  • 8
162
votes
8 answers

Why #define TRUE (1==1) in a C boolean macro instead of simply as 1?

I've seen definitions in C #define TRUE (1==1) #define FALSE (!TRUE) Is this necessary? What's the benefit over simply defining TRUE as 1, and FALSE as 0?
user2468316
12
votes
3 answers

determine board type of Arduino

How can one determine the board type (e.g. Uno vs Nano) of an Arduino at time of compile? Not to be confused with determining the processor type. As I see examples of this e.g. #if defined(__AVR_ATmega32U4__) ... I would like a way, similarly, to…
mpflaga
  • 2,807
  • 2
  • 15
  • 19
7
votes
2 answers

How to get log from Process.Start

I'm going to precompile an asp.net application in my custom c# form. How do i retrieve the process logs and check whether it is a successful process or not? Here's my code string msPath = "c:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\"; string…
Martin Ongtangco
  • 22,657
  • 16
  • 58
  • 84
5
votes
3 answers

Preprocessor macro overriding function definition in c++

I am fairly familiar with the basics of C++, but lack experience (mainly code in Java), so slightly "dumbed down" replies would be appreciated :) I am extending a larger open source project, which uses a standard visual studio class limits.h, where…
Samuel Neugber
  • 1,041
  • 1
  • 11
  • 17
3
votes
3 answers

Does the included header file expand in the C file

Take the following very simple C program below. My understanding is that the precompiler is first invoked to expand macros and header files etc. My understanding was that the precompiler would first include all the code (declarations) from the…
Engineer999
  • 3,683
  • 6
  • 33
  • 71
3
votes
1 answer

Implementing an Array Based Memory Pool of Various Sized Structs

I am working on a concurrent data structure that uses a number of small sized temporary objects. A lot of these objects are the same size. So to reduce the strain on the memory allocator I have been using a thread local map to store the objects as…
Steven Feldman
  • 833
  • 1
  • 15
  • 28
2
votes
1 answer

pre-compiler switches in java: how to change the path for an imported class

I need to use the same class on two diffwrent platform-SDKs. Although the class and its methods are the same the path to access the class is different. On one device I need to use: import a1.a2.classname while for the second device I need to…
kingston
  • 11,053
  • 14
  • 62
  • 116
2
votes
0 answers

How to generate a MicroPython QSTR from a C macro?

I'm using MicroPython and I would like to generate a QSTR that contains the contents of a macro. For example, I have the following macro: #define MY_MACRO "hello" How can I generate a QSTR that has the value "hello" and is called…
Pablo
  • 121
  • 4
2
votes
2 answers

Where is the C precompiler for Oracle10g located?

I am looking for a newer version of the Pro*C/C++ to upgrade my procui.exe 9.0.1.1.1. I downloaded the 10g client disk and when install I have the following options: instant client administrator runtime custom I dont seem to able to find…
HY.
  • 123
  • 1
  • 1
  • 8
1
vote
2 answers

Is there a way to merge / concatenate precompiler lists with C++ macros?

I have two lists: #define LIST1 {1, 2, 3} #define LIST2 {4, 5, 6} and using C++ macros I would like to write something like this: // Obviously doesn't work #define MERGE LIST1 ## LIST2 int my_array[] = MERGE; to yield: int my_array[] = {1, 2, 3,…
keenick4
  • 33
  • 7
1
vote
1 answer

static_assert throws error 'non-constant condition for static assertion'

Why is this code a non-constant condition? static_assert(4294965 * 1000 / 1000 == -2, "overflow occurs"); But this is not: const int overflowed = 4294965 * 1000 / 1000; static_assert(overflowed == -2, "overflow occurs"); See code on godbolt. Note:…
kuga
  • 1,483
  • 1
  • 17
  • 38
1
vote
0 answers

Make, Endpoints that differ by precompiler-flag

Using make, I need to produce two versions of an executable, which differ by the use of a precompiler flag DXYZ. The way I have this working so far is to produce the *.o objects for the vanilla program, and, another set *.o_xyz for the objects that…
Nicholas Hamilton
  • 10,044
  • 6
  • 57
  • 88
1
vote
1 answer

Use file content as hardcoded string

I'm looking for an easy way to use the content of a file as hardcoded string constant. Of course i could just copy/paste the file content into an define but that would require me to put \s at the end of each line and in front of each ". I tried to…
Detonar
  • 1,409
  • 6
  • 18
1
vote
0 answers

How to calculate and SHOW value of #define macro VStudio

I know how to show expanded macro in C. However, I am interested in how to show a calculated value of a macro. Precompiler definitely calculates macro values in order to do #if(a>b) statement: #define STRINGIFY(s) XSTRINGIFY(s) #define XSTRINGIFY(s)…
Igor K
  • 31
  • 2
1
2 3