Comments (6)
Are you sure about that code? Shouldn't it feature _Static_assert actually, since static_assert is C++'s stuff.
Yes. static_assert is C11 stuff too. It is a macro which is defined in assert.h and expanded into _Static_assert
this also seems a better hacky solution alternative for the second:
This is pretty much the same solution, except msg is not a string but a token, and it tests the condition.
from mlib.
I actually had a problem while compiling that statis_assert was not defined, but _Static_assert worked fine. Are you sure it is defined in assert.h and that file is actually included?
from mlib.
Yes, it is. as per C11:
The header <assert.h> defines the assert and static_assert macros
and assert.h is unconditionally included in m-core.h
Which system are you using? compiler + options ?
from mlib.
I can't say exactly what I've used that day, but only changing to _Static_assert has fixed the issue for me. Let me check one more time later.
from mlib.
Here is what I did to reproduce:
Note: My fork uses M_ prefix for array definitions. So I have removed the M_ from here in the test-marray.c
Now I get this error:
If I replace with _Static_assert the assertion is showed correctly.
I'm using this command to compile on Windows 10: C:\PROGRA~1\LLVM\bin\clang.exe -D__STDC_WANT_LIB_EXT1__=1 -D__STDC_WANT_LIB_EXT2__=1 -I../. -g -Xclang -gcodeview -O0 -D_DEBUG -D_DLL -D_MT -Xclang --dependent-lib=msvcrtd -fmacro-backtrace-limit=0 -Wall -Wextra -Werror -Wno-unused-function -Wno-unused-macros -Wno-gnu-zero-variadic-macro-arguments -Wno-c++98-compat-pedantic -Wno-old-style-cast -Wno-zero-as-null-pointer-constant -MD -MT tests/CMakeFiles/test-marray.dir/test-marray.c.obj -MF tests\CMakeFiles\test-marray.dir\test-marray.c.obj.d -o tests/CMakeFiles/test-marray.dir/test-marray.c.obj -c ../tests/test-marray.c
from mlib.
I was able to reproduce this behavior.
This is definitely a bug in CLANG for windows as it claims to be C11 but fails to deliver a working assert.h
I have implemented a workaround in master.
from mlib.
Related Issues (20)
- Compiler errors HOT 3
- README example not work HOT 3
- Add EMPLACE_TYPE support for B+TREE, DICT, RB-TREE, BUFFER, CONCURRENT HOT 3
- bitset: function for getting minimum index with bit set HOT 3
- Memory leak HOT 5
- How to define REALLOC in OPLIST? HOT 1
- Bug in list? HOT 1
- Allocator customization HOT 2
- How to define a set of pointer? HOT 1
- Github actions failure HOT 1
- Non-null array get() after reset() HOT 1
- Missing explanation of how to access multiple values in a BPTREE_MULTI HOT 2
- M_EMPTY_P(max) doesn't work HOT 4
- BPTREEI_OPLIST2_P4 missing push definition?
- Is it actually possible to create a fixed-size looping buffer? HOT 10
- BUFFER_DEF / BUFFER_THREAD_UNSAFE: performance issue HOT 1
- RB-tree _it_from on root node HOT 1
- Memory issue with _pop_at function while using 2d arrays HOT 1
- string_t: extremely confusing methods names: string_clean and string_clear HOT 5
- Change _str suffix HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlib.