Questions tagged [compile-time-constant]

Use this tag for questions related to the compile time constant, a constant value that is known at compile time.

A expression is an expression denoting a value of primitive type or a String that is composed using only the following:

is uses in its general meaning, but you should provide the relevant tag of your programming environment, if any.

300 questions
0
votes
1 answer

Get compile-time variable at runtime

I am trying to use the "define" mxmlc compiler option to embed compile-time constants into my SWF files. I can access this variable if I "hardcode" it into my…
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
0
votes
0 answers

How to declare objects as constants in Objective-C?

I found this question that explains very well how to declare a constant NSString or primitive type in Objective-C. The method worked perfectly. I ran into a problem when, recently, I was writing an application using CoreBluetooth. There are several…
William Rosenbloom
  • 2,506
  • 1
  • 14
  • 37
0
votes
2 answers

How to define a compile time constant in an assembly?

First of all: I am using C++-CLI, but I would like to know the solution for C# as well. Using following code assembly "basics" public ref class CONSTS abstract sealed { public: static const int SUCCESS = 1; static const int InProgress =…
Tobias Knauss
  • 3,361
  • 1
  • 21
  • 45
0
votes
3 answers

container class for constant data with compile time initialization

I search something which is std::vector but without the big overhead and a bit more than std::array, because with std::array I did not have the size stored anyway ( it is only known from the type itself ). What I want to achieve: Written with…
Klaus
  • 24,205
  • 7
  • 58
  • 113
0
votes
0 answers

Following AVFoundation programming guide raises compile-time constant error

I'm new to objective-C and completely self taught, so i could be making a very obvious mistake, but to my knowledge i'm following the AVFoundation programme guide directly and it raises errors that the guide doesn't warn me about. I've found…
0
votes
2 answers

Are there consequences to #define this self?

Long has Objective C annoyed me with its decision to use self instead of this. Now, I want to end that frustration by placing this code somewhere at or near the start of my program: #define this self I know this will compile, and likely will work…
Ky -
  • 30,724
  • 51
  • 192
  • 308
0
votes
1 answer

Define a compile-time constant from an external value

I would like to define a version number in a main class in each jar file that is assigned at compile time, like what can be easily done in C with an #include statement with a value from an external file. I would like to only set a value in that…
Mike
  • 103
  • 8
0
votes
2 answers

Define (and compute) a C constant at compile time

Say that my C code uses a constant RANGEMAX that is the largest power of 10 fitting in an int. I can define it with: #include #if (INT_MAX < 1) #define RANGEMAX ERROR1 #elif (INT_MAX >= 1) && (INT_MAX < 10) #define RANGEMAX 1 #elif…
phs
  • 541
  • 3
  • 18
0
votes
1 answer

Error 1046: Type was not found or was not a compile-time constant: Program

I'm trying to link my .as file to my Flash program. Below is the code from my .as file: package com.project { import flash.display.Sprite; import flash.events.*; public class Program extends Sprite{ public var value:Number; private var…
0
votes
3 answers

passing a templated class with constants as an argument

My template class looks like this: template class matrix { ... } So plain and simple, the template arguments determine this size of the matrix. The size is logically constant, so I implemented it…
TeaOverflow
  • 2,468
  • 3
  • 28
  • 40
0
votes
2 answers

iOS: different debug and release constants, objective-c

I'm new to objective-c and ios development and looking for best practice. I want to have different constants BASE_URL which is dependant on DEBUG and PRODUCTION environment.. I want it to look like, e.g. Constants.m: #import "Constants.h" static…
Kosmetika
  • 20,774
  • 37
  • 108
  • 172
0
votes
1 answer

Compile time optimization of simple math expressions in C++

I have a piece of code which basically adds some constant number to all elements of an array Matrix a.array() += 32768; //Bad due to hard coded literal Matrix has scalar type of unsigned short int. Some other options I am exploring are as…
iNFINITEi
  • 1,504
  • 16
  • 23
0
votes
0 answers

How to implement a compile time getter, for a more concise call?

I want to implement a compile-time getter in a way to make its call more concise. I have a non-type (unsigned int N) class template foo, which recursively inherits from foo. Every foo has its own enum member called number, which is…
0
votes
0 answers

custom compiler contants in vb.net web site project

I'm working on a web site project on vb.net - asp.net 4 - visual studio 2010. I need to implement a part of code that is used only when debug compilation is chosen within visual studio, e.g.: ' do something #if DEBUGCONST ' debug mode! do something…
0
votes
1 answer

Parametrize annotation value

I have two classes using annotations to define links between fields and database column names. These classes are very similar except for the column name they define: class TableA { @ForeignName("IDTableA") // Column name in TableC referring to…
Matthieu
  • 2,736
  • 4
  • 57
  • 87
1 2 3
19
20