Skip to content

Instantly share code, notes, and snippets.

@kfish
kfish / cpp_static_inline_extern.md
Last active June 11, 2024 22:34
C++ Visibility and Linkage of static, inline and extern

Visibility and Linkage of static, inline, and extern

static inline

// foo.h
static inline bool use_foo = true;
  • static: Limits the variable's linkage to the current translation unit. Each translation unit (source file including this header) will have its own separate instance of use_foo.
@roovo
roovo / CanvasTexture.elm
Created April 11, 2017 16:07
elm: stuff wot I did to get text from canvas into webGL
module CanvasTexture exposing (canvasTexture)
-- imports are weird for Native modules
-- You import them as you would normal modules
-- but you can't alias them nor expose stuff from them
import Task exposing (Task)
import WebGL exposing (Error, Texture)
import Native.CanvasTexture
-- this will be our function which returns a number plus one
@ion1
ion1 / FloatMinMax.hs
Created September 2, 2011 07:47
The minimum and maximum positive, finite floats
-- | The minimum and maximum positive, finite floats.
module FloatMinMax
( floatMin
, floatMaxDenorm
, floatMinNorm
, floatMax
)
where