Giter VIP home page Giter VIP logo

fast_io's People

Contributors

au-lit avatar bbsy789 avatar coderhare avatar falfiya avatar havedifficultyinfindingnames avatar hzl9900 avatar ikspress avatar toge avatar trcrsired avatar umu618 avatar zyddnys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fast_io's Issues

Inspired by coalpha's project. fast_io's iobuf has a constant size that can be further optimized

Instead of splitting the code path, if the buffer output stream can guarantee the minimal required size after flushing, the code should first flush and then call the code.

It comes up with how to deal with the buffer when it does not provide enough space. Now fast_io writes to an array and then calls write when the area is insufficient.

We will add a new concept to provide support to ensure the io buffer always has enough space after flush. This is to cut the code branch for the boundary case; then, it should improve io performance by another 20%

It works when the buffer size is not available statically. (stdio FILE* and stream, for example) but fast_io's basic_io_buffer knows precisely what the size is. It is a constant, of course, this still won't work for codecvt-related features, but it is much better for integers, floating points, etc.

This should also greatly reduce fast_io's binary size

iso8601 context scan accepts incorrect format

constexpr auto tsp = fast_io::to<fast_io::iso8601_timestamp>("02022-10-12T12:00:00Z");

calls contiguous scan and will reject to compile.

constexpr auto tsp = fast_io::to<fast_io::iso8601_timestamp>("02022-10-12T", "12:00:00Z");

calls context scan and will work. But it's not a valid timestamp string.

phase out all wchar_t in the code base.

it is just wrong to assume sizeof(wchar_t) would necessarily be 2 on windows. GCC even has toggle to change that.

They should all use char16_t instead.

char16_t must be the default character type for NT kernel.

examples of the pipe for fast_io

Could you please add the usage of pipes to the example? Why native_pipe uses CreatePipe under win32. There is no implementation of CreateNamedPipe

怎么设置locale

想让下面的中文输出不乱码
print(native_stdout<char16_t>(), u"你好");

fuzzer crash in addrprt

INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3104459081
INFO: Loaded 1 modules (431 inline 8-bit counters): 431 [0x55728be4c640, 0x55728be4c7ef),
INFO: Loaded 1 PC tables (431 PCs): 431 [0x55728be4c7f0,0x55728be4e2e0),
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: A corpus is not provided, starting from an empty corpus
#2 INITED cov: 2 ft: 2 corp: 1/1b exec/s: 0 rss: 36Mb
NEW_FUNC[1/11]: error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x2133c
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x24399
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x24e91
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x3102b
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x3ecfd
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x42956
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x43313
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x44e26
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x46295
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x46ca9
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x48110
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x481f8
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x4820f
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x48280
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x4dd6f
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x4e354
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x4e69d
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x4fda9
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x51158
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x546ba
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x54fda
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x56183
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x85eba
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x89de9
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x89fe9
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x8afb9
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x8b466
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x8cc14
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x8ce63
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x8f5dc
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x8f97f
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x8fe0f
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x8fef3
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9045a
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9063a
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x91bb6
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x91e10
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9499e
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x94e3b
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x96ffe
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x975bf
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x982bc
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9852d
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9883d
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x98dc9
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x998c7
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x99c7a
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x99ca5
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9a322
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9aaab
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9afda
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9b173
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9b71d
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9b929
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9db4c
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9dd52
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9e025
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9e0a5
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9e992
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9edc8
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9fc3c
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0x9fd6e
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa00a6
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa0330
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa074f
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa24aa
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa2e00
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa2fa1
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa39d4
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa3ae1
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa3e5c
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa3f0c
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa4fa4
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa5884
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa627f
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa64f8
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa8dae
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa90c9
error: did not detect a valid list table with base = 0x0
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa99ea
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa9b4b
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xa9cd2
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xaaf8f
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xab385
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xab4da
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xab97b
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xabd4c
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xabda2
error: did not detect a valid list table with base = 0x0
error: decoding address ranges: invalid range list offset 0xabec0
0x55728bdfe090 in char* fast_io::details::prtrsv_inaddr_common_define_impl(char*, unsigned char const*) ../../include/fast_io_core_impl/socket/addrprt.h:11
NEW_FUNC[2/11]: 0x55728bdfe730 in char* fast_io::details::jeaiii::jeaiii_tree<0ul, 9ul, char>(char*, unsigned int) ../../include/fast_io_core_impl/integers/jeaiii_method.h:134
#1031 NEW cov: 99 ft: 100 corp: 2/15b lim: 14 exec/s: 515 rss: 37Mb L: 14/14 MS: 4 InsertRepeatedBytes-EraseBytes-InsertRepeatedBytes-CrossOver-
#1035 NEW cov: 101 ft: 112 corp: 3/29b lim: 14 exec/s: 517 rss: 37Mb L: 14/14 MS: 4 ChangeBit-ChangeBit-ChangeByte-ChangeBinInt-
#1056 NEW cov: 101 ft: 126 corp: 4/43b lim: 14 exec/s: 528 rss: 37Mb L: 14/14 MS: 1 ChangeByte-
#1065 NEW cov: 101 ft: 141 corp: 5/57b lim: 14 exec/s: 532 rss: 37Mb L: 14/14 MS: 4 ChangeByte-CopyPart-ChangeBinInt-CrossOver-
#1079 NEW cov: 101 ft: 144 corp: 6/71b lim: 14 exec/s: 539 rss: 37Mb L: 14/14 MS: 4 ChangeByte-CrossOver-ChangeByte-CopyPart-
#1090 NEW cov: 103 ft: 147 corp: 7/85b lim: 14 exec/s: 545 rss: 37Mb L: 14/14 MS: 1 ChangeBinInt-
#1108 NEW cov: 103 ft: 157 corp: 8/99b lim: 14 exec/s: 554 rss: 37Mb L: 14/14 MS: 3 ShuffleBytes-ShuffleBytes-ChangeBinInt-
#1154 NEW cov: 104 ft: 159 corp: 9/113b lim: 14 exec/s: 577 rss: 37Mb L: 14/14 MS: 1 ShuffleBytes-
#1183 NEW cov: 108 ft: 181 corp: 10/127b lim: 14 exec/s: 591 rss: 37Mb L: 14/14 MS: 4 ShuffleBytes-EraseBytes-CMP-CrossOver- DE: "\001\000\000\000\000\000\000\000"-
#1193 NEW cov: 108 ft: 183 corp: 11/141b lim: 14 exec/s: 596 rss: 37Mb L: 14/14 MS: 5 CopyPart-ShuffleBytes-ChangeByte-ShuffleBytes-CopyPart-
#1205 NEW cov: 109 ft: 184 corp: 12/155b lim: 14 exec/s: 602 rss: 37Mb L: 14/14 MS: 2 CrossOver-ChangeByte-
#1222 NEW cov: 109 ft: 188 corp: 13/169b lim: 14 exec/s: 611 rss: 37Mb L: 14/14 MS: 2 ChangeByte-CrossOver-
==209== ERROR: libFuzzer: deadly signal
error: did not detect a valid list table with base = 0x0
warning: parsing line table prologue at 0x0000af25 should have ended at 0x0000b267 but it ended at 0x0000b266
#0 0x55728bdc15fa in __sanitizer_print_stack_trace (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x1695fa)
#1 0x55728bccaae4 in fuzzer::PrintStackTrace() (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x72ae4)
#2 0x55728bcadc56 in fuzzer::Fuzzer::CrashCallback() (.part.0) (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x55c56)
#3 0x55728bcadd16 in fuzzer::Fuzzer::StaticCrashSignalCallback() (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x55d16)
#4 0x7fa349b0c41f (/lib/x86_64-linux-gnu/libpthread.so.0+0x1441f) (BuildId: 7b4536f41cdaa5888408e82d0836e33dcf436466)
#5 0x7fa3498f600a in __libc_signal_restore_set /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/internal-signals.h:86:3
#6 0x7fa3498f600a in raise /build/glibc-SzIz7B/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:48:3
#7 0x7fa3498d5858 in abort /build/glibc-SzIz7B/glibc-2.31/stdlib/abort.c:79:7
#8 0x7fa349d23809 (/usr/local/lib64/libstdc++.so.6+0xb9809)
#9 0x7fa349d23874 in std::terminate() (/usr/local/lib64/libstdc++.so.6+0xb9874)
#10 0x55728bdfe08a in __clang_call_terminate (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x1a608a)
#11 0x55728bdfe079 in LLVMFuzzerTestOneInput /mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/validate_scan.cc:29:15
#12 0x55728bcae16c in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x5616c)
#13 0x55728bcb05a0 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool, bool*) (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x585a0)
#14 0x55728bcb16e0 in fuzzer::Fuzzer::MutateAndTestOne() (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x596e0)
#15 0x55728bcb2717 in fuzzer::Fuzzer::Loop(std::vector<fuzzer::SizedFile, std::allocatorfuzzer::SizedFile >&) (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x5a717)
#16 0x55728bc93876 in fuzzer::FuzzerDriver(int*, char***, int ()(unsigned char const, unsigned long)) (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x3b876)
#17 0x55728bc7f602 in main (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x27602)
#18 0x7fa3498d7082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#19 0x55728bc7f64d in _start (/mnt/d/vsfiles/fast_io_forked/fuzzing/0009.ipv6/a.out+0x2764d)

NOTE: libFuzzer has rudimentary signal handlers.
Combine libFuzzer with AddressSanitizer or similar for better crash reports.
SUMMARY: libFuzzer: deadly signal
MS: 3 CMP-CopyPart-CMP- DE: "Q\316BG\243\177\000\000"-"\001\000\000\000\000\000\000\000"-; base unit: 4fccbe254cb215e8e1a08cff5cb082587a63676b
0x0,0xcc,0xa,0x0,0x4c,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x47,
\000\314\012\000L\001\000\000\000\000\000\000\000G
artifact_prefix='./'; Test unit written to ./crash-c78245096f3c6d73a4d5b4a878f335c2b630a733
Base64: AMwKAEwBAAAAAAAAAEc=

purge 90% iterator interface in fast_io

The original design is that all the formatting APIs should support all categories of iterators. However, with time, we discover that most iterators' categories are completely useless. Even if that is sometimes useful (despite the original thought It would be useful it is not), doing that with pointer ranges in a buffer and then copying the buffer to the iterator ranges always work. C++ iterator model is not a zero-overhead abstraction.

It becomes a burden on the interface, performance, binary size, and compilation speed, and pulling things like ranges in the header hurts compilation speed.

Wiki down

I'm trying out your lib for my embedded project (since it upgraded to C++20 recently).

Now I could access your documentation 2 weeks ago, but now it's gone:

https://gitee.com/qabeowjbtkwb/fast_io/wikis

Could you refresh the link? I thought there was an example of outputting through an iterator which is what I need :)

Issue: native_file_loader fails to load file which is above the size of physical memory. Todo: Add a flag to file_loaders for MMAP flags

It has been reported that native_file_loader failed to load file over the size of physical memory since it uses MMAP_PRIVATE + PROT_WRITE flags. This will force linux kernel to fail if the file size is above the size of physical memory.

It should have some new flags to allow MMAP_SHARED + PROT_READ flags or even PROT_EXEC to allow users to create things like shared libraries manually with the native_file loader.

Todo: Remove fstat stat calls. Replace them with statx syscall

bminor/glibc@e6547d6

As glibc's commit points out, loongarch is the first architecture that would no longer be for both fstat and stat.

The reason is quite simple, statx is an objectively better syscall than fstat and stat. It makes no sense to continue using fstat or stat anymore on Linux.

If loongarch opens the door for not supporting fstat and stat, it is time to avoid them for all architectures.

However, this would make the emulation on windows much more complex, but I guess the gain worth the cost.

scan double / float

现在scan还是不能读入double或float吗?GCC和MSVC试了都不行。

请问能否出个本地化指南?

我尝试仿照https://www.bilibili.com/video/BV1wo4y117这个视频中本地化的代码,结果抛出异常:没有找到模块。于是我cmake打开编译l18n库选项,编译并安装了l18n库。
现在,它能正确加载库了,也能正常显示std::chrono了。但是blvw是什么函数?我在百度谷歌必应找不到任何相关代码。

而且l18n库是否能在windows下使用MSVC编译安装?是否需要把*.so后缀改成*.dll?是否需要把库路径添加进path?

is const qualifier necessary in this api?

Note that the function scan_context_define is required to return type parse_result<char_type const*>.

template<typename char_type, typename T>
concept context_scanable = requires(char_type const* begin, char_type const* end, T t)
{
	requires requires(typename std::remove_cvref_t<decltype(scan_context_type(io_reserve_type<char_type,T>))>::type st)
	{
		{scan_context_define(io_reserve_type<char_type,T>,st,begin,end,t)}->std::same_as<parse_result<char_type const*>>;
		{scan_context_eof_define(io_reserve_type<char_type,T>,st,t)}->std::same_as<parse_code>;
	};
};

And in the function scan_single_impl, the result of the iterator from scan_context_define is directly passed into the function ibuffer_set_curr, which wants a pointer to a non-const char.

auto curr{ibuffer_curr(in)};
auto end{ibuffer_end(in)};
auto [it,ec]=scan_context_define(io_reserve_type<char_type,T>,state,curr,end,arg);
ibuffer_set_curr(in,it);

The ibuffer_set_curr itself doesn't require any const requirements, it only want a pointer which const specifier is equal to the one passed to the begin parameter of scan_context_define. And the reason for ibuffer_set_curr no to receive a pointer to const is that it wants to use the pointer to modify the one in the buffer, which may be non-const, (strictly, the same const qualifier as the one passed to the begin).
The problem is like those in the chain-calling, where the const member function cannot return a non-const *this, and the exact semantic is to return a *this whose const qualifier should be equal to the one passed in the function.
I tend to solve the problem by passing pointer to const into the function, and doing const_cast in the function.

How to write custom input devices to work with scan()?

I'm enjoying fast_io so far. Everything is quite intuitive. However, I have multiple questions:

  1. I tried to implement input devices for printing to string and reading from std::string. I succeeded at the former, but failed with the later. I can't wrap my head around how you intended custom reader to work? Can you give me an example? This is my code so far:
#include<fast_io_device.h>
#include<fast_io.h>
#include<string>

/* custom output */

class string_writer
{
public:
	using char_type = char;
	std::string& ref_;
};

template<std::contiguous_iterator Iter>
constexpr void write(string_writer str, Iter begin, Iter end)
{
	str.ref_.append(begin, end);
}

/* custom input */

class string_reader
{
public:
	using char_type = char;
	const std::string& ref_;
};

template<std::contiguous_iterator Iter>
constexpr Iter read(string_reader, Iter begin, Iter end)
{
	/* How to access ryu fp parsing and int parsing?
	.. and where to save the read-out values? */
	return begin; // EOF
}

int main()
{
	// output
	std::string ostr;
	print(string_writer{ostr}, "Hello ", 4, " ever!");
	print(ostr);

	// input (doesn't work yet)
	// std::string istr = "2, 3";
	// int a,b;
	// scan(string_reader{istr}, a, b); <-- make this work
	// print(a,b);
}

/*
g++ -o compile compile.cc -Wall -Ofast -std=c++20 -s -flto -march=native -I../../include
*/
  1. How can get the next character like std::istream::get() and peek the next character like std::istream::peek() with fast_io?

[macOS M1]Undefined symbols for architecture arm64

在我的 MBP M1 编译 examples/0002.a+b,发生错误:

$ g++ -Ofast -std=c++20 -flto -I../../include -o a+b a+b.cc
undef: __srget
Undefined symbols for architecture arm64:
  "__srget", referenced from:
      bool fast_io::details::scan_context_status_impl<fast_io::basic_c_family_io_observer<(fast_io::c_family)1, char>, fast_io::manipulators::scalar_manip_t<fast_io::manipulators::scalar_flags{36ul, false, false, false, false, false, false, false, true, false, false, (fast_io::manipulators::scalar_placement)0, (fast_io::manipulators::floating_format)1}, unsigned long&> >(fast_io::basic_c_family_io_observer<(fast_io::c_family)1, char>, fast_io::manipulators::scalar_manip_t<fast_io::manipulators::scalar_flags{36ul, false, false, false, false, false, false, false, true, false, false, (fast_io::manipulators::scalar_placement)0, (fast_io::manipulators::floating_format)1}, unsigned long&>) in cc-fd9180.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

然后 examples/0003.manipulators 也出错:

$ g++ -Ofast -std=c++20 -flto -I../../include -o width width.cc
width.cc:6:10: error: use of undeclared identifier 'left_width'
        println(left_width("hello",20));
                ^
width.cc:7:10: error: use of undeclared identifier 'middle_width'
        println(middle_width("hello",20));
                ^
width.cc:8:10: error: use of undeclared identifier 'right_width'
        println(right_width("hello",20));
                ^
3 errors generated.

fast_io failing with GCC 13.0.1; no issues with GCC 12.2.0.

Blessings and grace. Thank you, for this wonderful library.

I'm testing Fedora 38 which provides GCC 13.0.1.

#include <fast_io.h>
$ g++ --version
g++ (GCC) 13.0.1 20230401 (Red Hat 13.0.1-0)

$ g++ -o llil4vec -std=c++20 -Wall -O3 llil4vec.cpp -I ./fast_io/include
In file included from ./fast_io/include/fast_io_core.h:49,
                 from ./fast_io/include/fast_io_freestanding.h:12,
                 from ./fast_io/include/fast_io_hosted.h:17,
                 from ./fast_io/include/fast_io.h:9,
                 from llil4vec.cpp:51:
./fast_io/include/fast_io_core_impl/utils.h: In instantiation of ‘constexpr const long unsigned int fast_io::details::compile_pow10<long unsigned int, 18>’:
./fast_io/include/fast_io_core_impl/integers/uprsv/dec.h:274:43:   required from here
./fast_io/include/fast_io_core_impl/utils.h:478:50: error: ‘constexpr T fast_io::details::compile_time_pow(T, std::size_t) [with T = long unsigned int; std::size_t = long unsigned int]’ used before its definition
  478 | inline constexpr T compile_pow10{compile_time_pow(std::remove_cvref_t<T>(10),pow)};
      |                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

print() 在有阻塞的情况下无法打印

下面样式的代码

print("something");

socket.recv(); //或是别的会引发阻塞的代码

会导致print()无法打印,或打印不完全
如print("Hello")会打印成Hel
在阻塞结束后继续打印

在Qt环境下大概率无法打印

Todo: Remove freestanding workarounds to use C++23 standard headers for freestanding

Since C++23, more headers and features (like std::addressof) are available now. Therefore, we need to remove all the workaround.

GCC provides extensions like making <array> and <span> be also in the freestanding C++ toolchain. However, we will still avoid them unless the C++ standard says something.

This will trim the library and make it more "standardized."

测试不完整/不公正

问题

fast_io 在和传统流式 I/O 的比较上可能存在不完整或不公正的部分。

在速度上:

  • 未将 Intel C++ 加入比较(C++ 11 比 C++ 20 可能不妥,但是性能第一位)。
  • 未将其余同属 Windows GCC 实现的编译器加入对比列表,而却挑中表现最一般的 MinGW-w64。
  • 未能提供(尽量)统一的编译参数。
  • 在提及 Rust 编程语言的速度时,未提及使用 Debug 还是使用 Release 编译。

在兼容性上:

  • 未实际测试此库和旧程序(使用流式 I/O 的程序)在复杂使用情况下的互相兼容性。

还请补充缺失的信息。


对于原作者偏见的一些反驳/解释

iostream 包含后暴增 800 K

以 gcc 为例,请在编译参数加入 -s(或更为激进的-Os -s),然后再试一次。支持 Release 版的,请用 Release 版。您要是禁用了优化或者只开了 -O1、带了符号表和调试信息,我无话可说。

面向对象 C with Classes 过时,使用 C with Concepts

您的行为等同于 Typescript + class 已经过时,建议使用 JavaScript function + Type description / interface。

此外,您几乎抛弃了兼容性,而这正是企业代码需要的。想必,您不会轻易在公司的老旧环境上使用 C++ 20 吧。

不用 fast_io 的人都是卢瑟

当个人和企业都不(愿意)广泛使用 fast_io 时,您是卢瑟。

链表淘汰了

您要是可以把数组(一定确保是连续内存)的插入时间复杂度变成 O(1),可能学 OI 的人都要跪下来叫您爷爷。

模板元不如 constexpr

是的,论数值计算模板元被 constexpr 可读性完爆,但是请您用 constexpr 函数,不用 template 关键字来遍历元组。

展开语法不计算在内,对数据的处理往往会更复杂。

--disable-hosted-libstdcxx 无法编译

请确认 GNU 对此的解释:

--disable-hosted-libstdcxx
By default, a complete hosted C++ library is built. The > C++ Standard also describes a freestanding environment, in which only a minimal set of headers are provided. This option builds such an environment.

您搞错了此选项的意思。请确认自己包含的头文件/用到的特性是否含在这些已提供的头文件中。

我还提到了特性,也就是说您可能需要添加额外的禁用参数来避免这些特性被默认打开,这样才能正常编译。

更多的偏见由于时间问题不再叙述。


总结

您的**“对于当代程序员来说太过超前”,以至于大家对您的风评并不好。

您的 fast_io 固然比流式 I/O 快,但无可否认地后者文档和实例多得数不胜数,并且提供了很棒的前向兼容性。在这一点上,您的 fast_io 毫无疑问地完败给了您看不起的流式 I/O。

一个更为实用的方向是尝试给以前版本的 C++ 提供高性能的 C++ 20 库的 polyfill,比如更优雅易用的 <coroutine>,这是大家都期盼的。

而现在提出的 I/O 提速虽然性能高但却不能贸然使用。因为换用 fast_io 的成本过高,且不是每个人都使用 C++ 20。

这个库的未来还未知,毕竟也没有实际使用提速的案例。

不过总体来说可以当成一个新奇的尝试就是了。


我年龄较小,本 issue 也未经过高人指点,若有任何事实错误或表意不清的位置,请不吝赐教。

Configure for use in embedded systems (esp32 using xtensa gcc)?

I'm working on an esp32 microcontroller. stdin and stdout are streamlined through UART I think. I don't know if the native libraries expose a posix API but I doubt it. In any case, how can I make it work? I don't actually need the stdin and stdout capabilities, they might as well be short circuited. I'm using fast_io mainly for scan to iterator or print to iterator.

Here are some of the errors I get when compiling without change (same compiles fine with msys mingw64 x86):

In file included from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/native_base.h:23,
                 from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/native.h:2,
                 from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted.h:56,
                 from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io.h:9,
                 from C:/dev/aurora-light-controller/main/app_main.cpp:14:
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h: In function 'std::size_t fast_io::details::posix_scatter_pread_size_impl(int, fast_io::io_scatters_t, intmax_t)':
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1791:70: error: 'len' was not declared in this scope
 1791 |         if(static_cast<std::size_t>(std::numeric_limits<int>::max())<len)
      |                                                                      ^~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1793:35: error: 'iovec_may_alias' does not name a type
 1793 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                   ^~~~~~~~~~~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1793:51: error: expected '>' before 'const'
 1793 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                                   ^~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1793:51: error: expected '(' before 'const'
 1793 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                                   ^~~~~
      |                                                   (
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1793:51: error: expected primary-expression before 'const'
 1793 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                                   ^~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1793:50: error: expected ')' before 'const'
 1793 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                                  ^~~~~~
      |                                                  )
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1793:51: error: expected '}' before 'const'
 1793 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                 ~                                 ^~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1793:51: error: expected ',' or ';' before 'const'
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h: At global scope:
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1794:44: error: '::preadv' has not been declared; did you mean 'readv'?
 1794 |         std::ptrdiff_t val{noexcept_call(::preadv,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                            ^~~~~~
      |                                            readv
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1794:51: error: 'fd' was not declared in this scope
 1794 |         std::ptrdiff_t val{noexcept_call(::preadv,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                                   ^~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1794:54: error: 'ptr' was not declared in this scope
 1794 |         std::ptrdiff_t val{noexcept_call(::preadv,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                                      ^~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1794:75: error: 'sz' was not declared in this scope
 1794 |         std::ptrdiff_t val{noexcept_call(::preadv,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                                                           ^~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1794:98: error: 'offset' was not declared in this scope; did you mean 'off_t'?       
 1794 |         std::ptrdiff_t val{noexcept_call(::preadv,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                                                                                  ^~~~~~
      |                                                                                                  off_t
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1795:9: error: expected unqualified-id before 'if'
 1795 |         if(val<0)
      |         ^~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1797:9: error: expected unqualified-id before 'return'
 1797 |         return static_cast<std::size_t>(val);
      |         ^~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h: In function 'std::size_t fast_io::posix_scatter_pwrite_size_impl(int, fast_io::io_scatters_t, intmax_t)':
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1817:35: error: 'iovec_may_alias' does not name a type
 1817 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                   ^~~~~~~~~~~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1817:51: error: expected '>' before 'const'
 1817 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                                   ^~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1817:51: error: expected '(' before 'const'
 1817 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                                   ^~~~~
      |                                                   (
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1817:51: error: expected primary-expression before 'const'
 1817 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                                   ^~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1817:50: error: expected ')' before 'const'
 1817 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                                                  ^~~~~~
      |                                                  )
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1817:51: error: expected '}' before 'const'
 1817 |         auto ptr{reinterpret_cast<iovec_may_alias const*>(sp.base)};
      |                 ~                                 ^~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1817:51: error: expected ',' or ';' before 'const'
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h: At global scope:
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1818:44: error: '::pwritev' has not been declared; did you mean 'writev'?
 1818 |         std::ptrdiff_t val{noexcept_call(::pwritev,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                            ^~~~~~~
      |                                            writev
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1818:52: error: 'fd' was not declared in this scope
 1818 |         std::ptrdiff_t val{noexcept_call(::pwritev,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                                    ^~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1818:55: error: 'ptr' was not declared in this scope
 1818 |         std::ptrdiff_t val{noexcept_call(::pwritev,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                                       ^~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1818:76: error: 'sz' was not declared in this scope
 1818 |         std::ptrdiff_t val{noexcept_call(::pwritev,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                                                            ^~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1818:99: error: 'offset' was not declared in this scope; did you mean 'off_t'?       
 1818 |         std::ptrdiff_t val{noexcept_call(::pwritev,fd,ptr,static_cast<int>(sz),static_cast<off_t>(offset))};
      |                                                                                                   ^~~~~~
      |                                                                                                   off_t
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1819:9: error: expected unqualified-id before 'if'
 1819 |         if(val<0)
      |         ^~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1821:9: error: expected unqualified-id before 'return'
 1821 |         return static_cast<std::size_t>(val);
      |         ^~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1825:8: error: 'io_scatter_status_t' does not name a type
 1825 | inline io_scatter_status_t posix_scatter_pwrite_impl(int fd,io_scatters_t sp,std::intmax_t offset)
      |        ^~~~~~~~~~~~~~~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1830:22: error: 'io_scatter_status_t' does not name a type
 1830 | [[nodiscard]] inline io_scatter_status_t posix_scatter_pread_impl(int fd,io_scatters_t sp,std::intmax_t offset)
      |                      ^~~~~~~~~~~~~~~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1834:1: error: expected declaration before '}' token
 1834 | }
      | ^
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1837:29: error: 'template<class char_type, class Iter>  requires (integral<char_type>) && (contiguous_iterator<Iter>) constexpr const Iter pread' redeclared as different kind of entity
 1837 | inline constexpr Iter pread(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                             ^~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/dev/esp/esp-idf/components/newlib/platform_include/sys/unistd.h:11,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\unistd.h:4,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\pthread.h:25,
                 from C:/dev/esp/esp-idf/components/newlib/platform_include/pthread.h:13,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\xtensa-esp32-elf\no-rtti\bits\gthr-default.h:35,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\xtensa-esp32-elf\no-rtti\bits\gthr.h:148, 
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\ext\atomicity.h:35,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\bits\basic_string.h:39,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\string:55,
                 from C:/dev/aurora-light-controller/main/app_main.cpp:2:
c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\sys\unistd.h:186:9: note: previous declaration 'ssize_t pread(int, void*, size_t, off_t)'
  186 | ssize_t pread (int __fd, void *__buf, size_t __nbytes, off_t __offset);
      |         ^~~~~
In file included from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/native_base.h:23,
                 from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/native.h:2,
                 from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted.h:56,
                 from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io.h:9,
                 from C:/dev/aurora-light-controller/main/app_main.cpp:14:
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1837:29: error: 'basic_posix_io_observer' was not declared in this scope; did you mean 'fast_io::basic_posix_io_observer'?
 1837 | inline constexpr Iter pread(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                             ^~~~~~~~~~~~~~~~~~~~~~~
      |                             fast_io::basic_posix_io_observer
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:371:7: note: 'fast_io::basic_posix_io_observer' declared here
  371 | class basic_posix_io_observer
      |       ^~~~~~~~~~~~~~~~~~~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1837:62: error: expected primary-expression before '>' token
 1837 | inline constexpr Iter pread(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                              ^
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1837:64: error: 'piob' was not declared in this scope
 1837 | inline constexpr Iter pread(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                                ^~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1837:74: error: expected primary-expression before 'begin'
 1837 | inline constexpr Iter pread(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                                          ^~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1837:85: error: expected primary-expression before 'end'
 1837 | inline constexpr Iter pread(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                                                     ^~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1837:103: error: expected primary-expression before 'offset'
 1837 | inline constexpr Iter pread(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                                                                       ^~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1843:30: error: 'template<class char_type, class Iter>  requires (integral<char_type>) && (contiguous_iterator<Iter>) constexpr const Iter pwrite' redeclared as different kind of entity
 1843 | inline constexpr Iter pwrite(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/dev/esp/esp-idf/components/newlib/platform_include/sys/unistd.h:11,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\unistd.h:4,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\pthread.h:25,
                 from C:/dev/esp/esp-idf/components/newlib/platform_include/pthread.h:13,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\xtensa-esp32-elf\no-rtti\bits\gthr-default.h:35,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\xtensa-esp32-elf\no-rtti\bits\gthr.h:148, 
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\ext\atomicity.h:35,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\bits\basic_string.h:39,
                 from c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\11.2.0\string:55,
                 from C:/dev/aurora-light-controller/main/app_main.cpp:2:
c:\dev\esp\.espressif\tools\xtensa-esp32-elf\esp-2022r1-rc1-11.2.0\xtensa-esp32-elf\xtensa-esp32-elf\sys-include\sys\unistd.h:187:9: note: previous declaration 'ssize_t pwrite(int, const void*, size_t, off_t)'
  187 | ssize_t pwrite (int __fd, const void *__buf, size_t __nbytes, off_t __offset);
      |         ^~~~~~
In file included from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/native_base.h:23,
                 from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/native.h:2,
                 from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted.h:56,
                 from C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io.h:9,
                 from C:/dev/aurora-light-controller/main/app_main.cpp:14:
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1843:30: error: 'basic_posix_io_observer' was not declared in this scope; did you mean 'fast_io::basic_posix_io_observer'?
 1843 | inline constexpr Iter pwrite(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~
      |                              fast_io::basic_posix_io_observer
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:371:7: note: 'fast_io::basic_posix_io_observer' declared here
  371 | class basic_posix_io_observer
      |       ^~~~~~~~~~~~~~~~~~~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1843:63: error: expected primary-expression before '>' token
 1843 | inline constexpr Iter pwrite(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                               ^
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1843:65: error: 'piob' was not declared in this scope
 1843 | inline constexpr Iter pwrite(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                                 ^~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1843:75: error: expected primary-expression before 'begin'
 1843 | inline constexpr Iter pwrite(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                                           ^~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1843:86: error: expected primary-expression before 'end'
 1843 | inline constexpr Iter pwrite(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                                                      ^~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1843:104: error: expected primary-expression before 'offset'
 1843 | inline constexpr Iter pwrite(basic_posix_io_observer<char_type> piob,Iter begin,Iter end,std::intmax_t offset)
      |                                                                                                        ^~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1849:22: error: 'io_scatter_status_t' does not name a type
 1849 | [[nodiscard]] inline io_scatter_status_t scatter_pread(basic_posix_io_observer<ch_type> piob,io_scatters_t sp,std::intmax_t offset)
      |                      ^~~~~~~~~~~~~~~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1855:8: error: 'io_scatter_status_t' does not name a type
 1855 | inline io_scatter_status_t scatter_pwrite(basic_posix_io_observer<ch_type> piob,io_scatters_t sp,std::intmax_t offset)
      |        ^~~~~~~~~~~~~~~~~~~
C:/dev/aurora-light-controller/components/fast_io/fast_io/include/fast_io_hosted/platforms/posix.h:1862:1: error: expected declaration before '}' token
 1862 | }
      | ^
ninja: build stopped: subcommand failed.
ninja failed with exit code 1, output of the command is in the c:\dev\aurora-light-controller\build\log\idf_py_stderr_output_18568 and c:\dev\aurora-light-controller\build\log\idf_py_stdout_output_18568

Remove operator new call

C++ operator new can always throw exceptions even if it is freestanding.

Just remove this nonsense.

Death to C++ new

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.