conditional-compilation

How can I conditionally execute a module-level doctest based on a feature flag?

試著忘記壹切 提交于 2021-02-20 06:40:26
问题 I am writing documentation for a module that has some options controlled by a Cargo feature flag. I'd like to always show this documentation so that consumers of the crate know that it's available, but I need to only run the example when the feature is enabled. lib.rs //! This crate has common utility functions //! //! ``` //! assert_eq!(2, featureful::add_one(1)); //! ``` //! //! You may also want to use the feature flag `solve_halting_problem`: //! //! ``` //! assert!(featureful::is_p_equal

Conditional Compilation of schema objects in SSDT Project

落花浮王杯 提交于 2021-02-19 08:26:17
问题 Our SSDT database project includes a table that has a computed column that can take one of several forms, depending on customer requirements. I'm trying to figure out how to manage this computed column so that we can still use the Publish function without reverting everyone's columns back to the default. What I'm trying to accomplish can be explained in the following invalid T-SQL code: CREATE TABLE dbo.Customer ( Id INTEGER, Region INTEGER, Name VARCHAR(50), AccountNumber AS dbo

Does Eclipse CDT's parser/indexer have a “self-identifying” preprocessor #define macro?

别等时光非礼了梦想. 提交于 2021-02-16 16:55:30
问题 I want to have some code only be included when Eclipse is parsing my source tree. At the moment, what I am doing^H^H^H^H^H trying to do is add a custom preprocessor macro - using Eclipse's Help | Preferences | C/C++ | Build | Setting Discovery - and insert a -DECLIPSE_BUILTIN into the various command-lines there. So I was wondering whether there is already a standard, a default, macro which the preprocessor (and the indexer?) define to 'identify' themselves like this to the code - to save me

How to optionally include certain code for certain features?

天涯浪子 提交于 2021-02-07 19:00:48
问题 In Inno Setup, I have a main script which is the "core system", meaning everything which is absolutely needed for our software to install/run at all. Additionally, I'm writing script files for each major feature which may or may not be compiled into the installer. At the top of the main script file, I include other script files... #include "AdditionalOption.iss" #include "AnotherOption.iss" When compiling this main script, the person compiling may choose whether or not to compile these

autoconf AS_IF doesn't execute correct branch

我是研究僧i 提交于 2021-01-28 08:00:42
问题 I'm having a bit of a mystery in a autoconf script, specifically AS_IF . Here's the relevant code: AC_CHECK_FUNCS([eventfd], [AC_DEFINE([NN_HAVE_EVENTFD])]) AC_CHECK_FUNCS([pipe], [AC_DEFINE([NN_HAVE_PIPE])]) AC_CHECK_FUNCS([pipe2], [ AC_DEFINE([NN_HAVE_PIPE2]) CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" ]) AC_SEARCH_LIBS([socketpair], [], [AC_DEFINE([NN_HAVE_SOCKETPAIR])]) i.e. checking for their existance. These work correctly and define the correct symbols. In this case, only NN_HAVE_PIPE and NN

Is this pointer type watertight?

北城以北 提交于 2021-01-28 07:56:06
问题 I'm trying to design a custom type that can be used in APIs which need window handles or other kinds of pointers, and which will work for all systems VBA can run on. Here's what I've got: #If (Win64 = 1) And (VBA7 = 0) Then Public Type LongLong '64-bit systems pre-VBA7 wouldn't have had LongLong LoPart As Long HiPart As Long End Type #End If Public Type Pointer 'could alternatively make a LongPtr type for pre VBA7 systems only #If VBA7 Then Address As LongPtr 'should always be correct right?

Conditional Compilation in common unit depending from specific project?

荒凉一梦 提交于 2021-01-27 14:13:58
问题 In Delphi XE2, I have a unit MyUnit.pas which is used by two different projects ProjectA and ProjectB . MyUnit contains a statement DoSomething; (which is a procedure implemented in an other unit OtherUnit.pas ). Now I want to use Conditional Compilation to include DoSomething only in ProjectA compilation and not in ProjectB compilation, so to avoid ProjectB including/compiling OtherUnit.pas indirectly. This MUST be Conditional Compilation , as a simple if/else statement obviously does not

Does '#'-character have to be at the start of a line in the C preprocessor? [duplicate]

試著忘記壹切 提交于 2021-01-02 05:19:06
问题 This question already has answers here : Should preprocessor instructions be on the beginning of a line? (5 answers) Closed 5 years ago . I have programmed C for quite a while now. During this time I have learned that it is a common convention to put the "#"-character that comes before preprocessor-directives at column one. Example: #include <stdio.h> int main(void) { #ifdef MACRO1 #ifdef MACRO2 puts("defined(MACRO1) && defined(MACRO2)"); #else puts("defined(MACRO1)"); #endif #else puts("