Compare commits

...

3 Commits

Author SHA1 Message Date
blueloveTH
76a17ab251 update docs about c99 2025-01-08 18:50:25 +08:00
blueloveTH
c044f5dd65 ... 2025-01-08 18:40:05 +08:00
blueloveTH
a4745a8bd9 add static_assert fallback 2025-01-08 18:38:30 +08:00
4 changed files with 15 additions and 5 deletions

View File

@ -37,6 +37,8 @@ Please see https://pocketpy.dev for details and try the following resources.
pkpy should work on any platform with a C11 compiler.
These platforms are officially tested.
> C99 compilers also work currently according to users' feedback.
+ Windows 64-bit
+ Linux 64-bit / 32-bit
+ macOS 64-bit
@ -72,7 +74,7 @@ It is safe to use `main` branch in production if CI badge is green.
To compile it with your project, these flags must be set:
+ `--std=c11` flag must be set
+ `--std=c11` flag must be set (`--std=c99` may also work)
+ For MSVC, `/utf-8` flag must be set
+ `NDEBUG` macro should be defined for release build, or you will get poor performance

View File

@ -29,9 +29,11 @@ print(primes)
## Supported platforms
pkpy should work on any platform with a C++17 compiler.
pkpy should work on any platform with a C11 compiler.
These platforms are officially tested.
> C99 compilers also work currently according to users' feedback.
+ Windows 64-bit
+ Linux 64-bit / 32-bit
+ macOS 64-bit

View File

@ -29,7 +29,7 @@ It is safe to use `main` branch in production if CI badge is green.
To compile it with your project, these flags must be set:
+ `--std=c11` flag must be set
+ `--std=c11` flag must be set (`--std=c99` may also work)
+ For MSVC, `/utf-8` flag must be set
+ `NDEBUG` macro should be defined for release build, or you will get poor performance

View File

@ -1,7 +1,6 @@
#pragma once
#include <stdio.h>
#include <stdlib.h>
#define PK_REGION(name) 1
@ -45,6 +44,13 @@ typedef struct RefCounted {
do { \
if(--(obj)->rc.count == 0) { \
(obj)->rc.dtor(obj); \
PK_FREE(obj); \
PK_FREE(obj); \
} \
} while(0)
// static assert
#ifndef __cplusplus
#ifndef static_assert
#define static_assert(x, msg) if(!(x)) c11__abort("static_assert failed: %s", msg)
#endif
#endif