Update README.md
[deliverable/titan.core.git] / common / static_check.h
1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Balasko, Jeno
10 * Raduly, Csaba
11 *
12 ******************************************************************************/
13 #ifndef STATIC_CHECK_HH
14 #define STATIC_CHECK_HH
15
16 #ifdef __cplusplus
17
18 template<bool> struct CompileTimeError;
19 template<> struct CompileTimeError<true> {}; // false never defined
20
21 #define STATIC_ASSERT(expr) CompileTimeError<(expr) != 0>()
22
23 #else
24
25 #define STATIC_ASSERT(x) do { enum { assert_static_ = 1/(x) }; } while(0)
26
27 #endif
28
29 #define ENSURE_EQUAL(x, y) STATIC_ASSERT((int)(x) == (int)(y));
30
31 #endif
This page took 0.031917 seconds and 5 git commands to generate.