conditional-compilation Questions

3

Suppose you have the following definition of a C++ class: class A { // Methods #ifdef X // Hidden methods in some translation units #endif }; Is this a violation of One Definition Rule for the cla...

9

Solved

My project requires Java 1.6 for compilation and running. Now I have a requirement to make it working with Java 1.5 (from the marketing side). I want to replace method body (return type and argumen...
Levitical asked 24/12, 2010 at 11:44

8

Solved

I doubt if there is a way to make compile-time conditions in Java like #ifdef #ifndef in C++. My problem is that have an algorithm written in Java, and I have different running time improves to th...

3

I have the following code (IP addresses changed) in a Delphi 7 project. const {$IFNDEF DEBUG} AUTHENTICATOR_DB_ADMIN_HOST = '123.456.789.12'; {$ELSE} AUTHENTICATOR_DB_ADMIN_HOST = '127.0.0.1'; {...

2

Solved

For our project we always used one source file for both platforms: iOS and macOS (previously OS X). Right now I am migrating to Swift. Unfortunately there is some files which need import Cocoa and...
Punchboard asked 13/10, 2014 at 12:10

1

Solved

I want to use #![feature(custom_test_frameworks)], but if possible only conditionally enable it via #[cfg(not(target_os = "custom_os_name"))]. I would still prefer to have the option to run some te...
Alys asked 10/6, 2020 at 9:50

2

Solved

I am working on some code where a buffer is backed by a statically sized array. Since Rust and the build tools provided by it offer the possibilities to compile conditionally, I can do something li...
Sartorial asked 3/8, 2019 at 12:51

2

Solved

I have a package I want to add an optional feature to. I've added an appropriate section to my Cargo.toml: [features] foo = [] I wrote an experimental test for the basic functionality of the cfg...
Oldster asked 17/11, 2019 at 23:57

5

Solved

I can recall back when working with MFC you could support multiple versions of the MFC framework by checking the _MFC_VER macro. I'm doing some stuff now with .NET 4 and would like to use Tuple in...
Indetermination asked 20/9, 2009 at 0:30

1

I'm working in VS 2013 with a C# Xamarin iOS project. I would like to add a Conditional compilation symbol without effecting anyone else or having to go into Configuration Manager and say copying D...

1

I have a crate that up to now had a feature that will no longer be needed. I'd like to deprecate it, but have no idea how. My plan so far is to make it a default feature first, but then what?
Taylor asked 6/7, 2019 at 21:27

2

Solved

Some assumptions: (correct me if wrong) Ignoring 16-bit stuff, VBA can be run on 32 or 64-bit Office hosts. 64-bit Office can only be run on a 64-bit OS, whereas you can run 32-Bit office on a 32 o...

1

Solved

I've already found this answer on how to check the Indy version at run-time, and there are multiple different ways. However I'm looking how to use conditionals to check the Indy version at compile-...
Dovev asked 30/6, 2019 at 16:7

11

I'm a longtime C++ programmer, new to Java. I'm developing a Java Blackberry project in Eclipse. Question - is there a way to introduce different configuration sets within the project and then comp...
Corm asked 17/12, 2009 at 15:29

1

Solved

Is it possible to mark certain includes to only get included on relevant OS's? For example, can you do something like: #[cfg(unix)] { use std::os::unix::io::IntoRawFd; } #[cfg(windows)] { ...
Boyles asked 4/2, 2019 at 12:20

2

I have found that writing #ifdef ... #elseif defined(...) #else #endif always results in using either the #ifdef or the #else condition, never the #elseif. But substituting #elif causes it to wo...
Krissykrista asked 21/3, 2016 at 17:4

5

Solved

In C++, is this: #ifdef A && B the same as: #if defined(A) && defined(B) ? I was thinking it wasn't, but I haven't been able to find a difference with my compiler (VS2005).
Intoxicant asked 21/8, 2009 at 14:1

1

Solved

I'm currently struggling using custom configurations. My solution has one .NET Standard Library and two other Projects (one for Windows, one for Android) which uses the library. What I try to do i...
Bodi asked 19/10, 2018 at 22:23

3

I have some helper methods marked with [Conditional("XXX")]. The intent is to make the methods conditionally compile when only the XXX conditional compilation symbol is present. We're using this fo...
Elgar asked 23/5, 2014 at 13:41

2

Solved

Does golang support #define DEBUG #ifdef DEBUG fmt.Println("Debug message..."); #endif So I can build a debug version with zero runtime overhead?
Inspirit asked 15/8, 2016 at 7:26

1

NET project in which I need to add contents in the resource file (which is an xml file) based on certain compilation symbols. something like the following: <xml ....> <myNodes> #if ...

1

Solved

I have a function that is capable of being implemented as a const: #![feature(const_fn)] // My crate would have: const fn very_complicated_logic(a: u8, b: u8) -> u8 { a * b } // The caller ...
Gastrology asked 25/3, 2018 at 19:11

3

Solved

Consider the following classes: public class A { public B GetB() { Console.WriteLine("GetB"); return new B(); } } public class B { [System.Diagnostics.Conditional("DEBUG")] public void Hell...
Frausto asked 13/3, 2018 at 10:7

4

Solved

I'm trying to write a program that compiles in Borland C++ and Visual C++. To do this, I add #ifdef _MSC_VER to include the stdafx.h file when the source is compiled under VS. The code compiles and...

1

I wonder if it is possible to build different installers which include different files for one deployment projects purely depending on the build configuration (Debug/Release)? I want to do this be...

© 2022 - 2024 — McMap. All rights reserved.