Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task example in README.md #107

Open
YehezkelShB opened this issue Apr 10, 2019 · 3 comments
Open

task example in README.md #107

YehezkelShB opened this issue Apr 10, 2019 · 3 comments

Comments

@YehezkelShB
Copy link
Contributor

task<T> example in README.md includes the following line:

auto file = co_await cppcoro::read_only_file::open(path);

This doesn't compile and I can't even find a point in the git history that such a function existed.
I guess this example started before the API was final and before the introduction of io_service.

@j-silver
Copy link

I was about to open another issue, but perhaps it's better to follow up this one, as they might be two cases of outdated documentation.

I'm new with coroutines and I'm learning by following the examples in the README.md page.
I tried to compile the first example, adding a main(), but the compiler immediately stops issuing an error: apparently there's a misplaced endif in the last lines of the header file_read_operation.hpp

This is the message (/usr/local/include/ is where I installed cppcoro, clang is 7.0.1 on Fedora Linux)

clang++ -fcoroutines-ts -Wall -Wpedantic -Wextra -Wconversion -Weffc++ -std=c++2a -I /usr/local/include/ -stdlib=libc++ -c test.cpp

In file included from test.cpp:1:
In file included from /usr/local/include/cppcoro/read_only_file.hpp:8:
In file included from /usr/local/include/cppcoro/readable_file.hpp:9:
/usr/local/include/cppcoro/file_read_operation.hpp:98:1: error: extraneous
closing brace ('}')
}

By inspecting the file it seems that the CPPCORO_OS_WINNT directive is closed too early. Is that OK? Is perhaps the example outdated and file_read_operation.hpp should never be used or am I missing something?

Furthermore, the same error mentioned by @YehezkelShB happens to me, with message:

test.cpp:8:58: error: too few arguments to function call, expected at least 2,
have 1
auto file = co_await cppcoro::read_only_file::open(path);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/local/include/cppcoro/read_only_file.hpp:44:3: note: 'open' declared here
static read_only_file open(

@YehezkelShB
Copy link
Contributor Author

Linux isn't supported yet for all the I/O stuff anyway (see #15), but the #ifdef would better be closed correctly, as preparation for such support to be implemented.

@j-silver
Copy link

Thanks. I didn't check the extension of Linux support. I guess I can wait a little bit more then...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants