Questions tagged [compile-time]

Refers to the information that can be inferred or known at the time source code is compiled, as opposed to information that can only be inferred when source code is run. Do not use this tag for questions about the time it takes for source code to be compiled.

In , compile time refers to either the operations performed by a (the "compile-time operations"), requirements that must be met by source code for it to be successfully compiled (the "compile-time requirements"), or properties of the program that can be reasoned about at compile time.

The operations performed at compile time usually include , various kinds of (e.g., type checks and instantiation of template) and .

Programming language definitions usually specify compile time requirements that must meet to be successfully compiled. For example, that the amount of storage required by types and variable can be deduced.

Properties of a program that can be reasoned about at compile time include range-checks (e.g., proving that an array index will not exceed the array bound), deadlock freedom in concurrent languages, or timings (e.g., proving that a sequence of code takes no more than an allocated amount of time).

Compile time occurs before (when the output of one or more compiled files are joined together) and runtime (when a program is executed).

In some programming languages it may be necessary for some compilation and linking to occur at runtime.

There is a trade-off between compile-time and link-time in that many compile time operations can be deferred to link-time without incurring extra run-time.

"Compile time" can also refer to the amount of time required for compilation.

Source: Wikipedia

925 questions
-2
votes
2 answers

Load Images At Compile Time in Java

I have made a program which loads approximately 66 images into the program when it is run. I load the images using a SwingWorker so that I can access the images quickly without having to load them when I click on a button. However, the loading takes…
Muhammad Umer
  • 69
  • 1
  • 11
-2
votes
1 answer

Code memory and data memory

When we write a particular code in C, that code gets allocated to either data memory or code memory. When are those memory initialised, at run time or compile time. Any possible explanation of why they are initialised that way?
-3
votes
1 answer

How to Cut Down Execution Time?

Here is a code snippet of a function that takes vector of strings (vector of customer names) and need to find names which occurs with some frequency. How to make it run faster (faster than 2 seconds especially operating with larger sets of data).…
-3
votes
1 answer

how to solve timeout error for this code in hackerrank

int sweet(int l,int n,int m ) { if(m==0) return l; if(l>=n) return sweet(1,n,m-1); else return sweet(l+1,n,m-1); } int display(int d) { if(d==0) …
-3
votes
2 answers

Why is the Duration of the Compile-time crucial important?

I often see programmers, especially here on StackOverflow, who indicate the compilation time of their respective programs and with that sometimes intend to reduce these corresponding periods, even if the result would be only just subtle. While, of…
-3
votes
3 answers

How to achieve "compile-time includes" in PHP?

PHP's include and require functions occur at runtime. Consider this script, page1.php:
Pacerier
  • 86,231
  • 106
  • 366
  • 634
-5
votes
1 answer

Are sizeof() statements evaluated at compile time or runtime?

Is it wasting memory to have something like static const char size = sizeof(struct MyStruct); If they are evaluated at compile time, that is like doing; static const char size = 10; functioncall(size); functioncall2(size); Which is more…
user12828925
-8
votes
1 answer

When does polymorphism occur

Iv'e seen some blogs and tutorials that say it can occur during compile time or run time, but i am doing a practice quiz and this is my choices. a. compile time b. run time c.debug time d. early binding time e. none of the above <--- my choice.
Xactical
  • 1
  • 3
-8
votes
4 answers

Is it really impossible to make a string into a variable in c++

Both Convert string to variable name or variable type and How to use a string as a variable name in C++? answers say you can not use a string as a variable after compile time. However, they mention that higher level languages such as python can. …
user-2147482637
  • 2,115
  • 8
  • 35
  • 56
1 2 3
61
62