# Compile-time constants

**URL:** <https://discourse.julialang.org/t/compile-time-constants/6039>\
**Category:** General Usage\
**Created:** [September 22, 2017, 2:20pm UTC](https://discourse.julialang.org/t/compile-time-constants/6039 "2017-09-22T14:20:04Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [September 22, 2017, 2:41pm UTC](https://discourse.julialang.org/t/compile-time-constants/6039/3 "2017-09-22T14:41:36Z")

</div>

1. Local constant declaration is ignored, they have no effect.
2. It is inlined, the extra code you get are simply due to different type.

```julia
julia> let
           FLAGA = 1<<32
           FLAGB = 1<<33

           global foo
           function foo(x::Int)
               return (0== (x & (FLAGA & FLAGB)))
           end
       end
foo (generic function with 1 method)

julia> @code_native foo(1)
        .text
; Function <invalid> {
; Location: REPL[1]
        pushq %rbp
        movq %rsp, %rbp
;}
; Function foo {
; Location: REPL[1]:7
        movb $1, %al
        popq %rbp
        retq
        nopl (%rax,%rax)
;}

julia> @code_warntype foo(1)
Variables:
  #self# <optimized out>
  x::Int64

Body:
  begin
      return (0 === (Base.and_int)(x::Int64, (Base.and_int)($(QuoteNode(4294967296)), $(QuoteNode(8589934592)))::Int64)::Int64)::Bool
  end::Bool

```

Also note that how much easier it is to see if the constant is inlined if you use the right tool (i.e. `code_warntype`)

---

_[View the full topic](https://discourse.julialang.org/t/compile-time-constants/6039)._
