You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get an odd warning for the following code I made for testing the library:
#include<iostream>
#include<cmath>
#include<cppcoro/generator.hpp>using std::cout;
using std::endl;
cppcoro::generator<int> primes();
intmain()
{
int i = 0;
for (auto p : primes())
{
cout << ++i << ": " << p << endl;
if (i >= 10000)
{
break;
}
}
return0;
}
cppcoro::generator<int> primes()
{
// simplified prime check// no p <= 1 check// no checking of div 2 or any other even number// can be simplified because we only test odd numbers >= 5 anywayconstauto pc = [](constint& val) {
for (int i = 3; i <= sqrt(val); i+=2)
if (val % i == 0)
returnfalse;
returntrue;
};
co_yield2;
int i = 3;
while (true) {
co_yield i;
do {
i+=2;
}while (!pc(i));
}
} // line 41 (warning is here)
I am not sure why that is. I do not use any switch statements at all.
The warning is always on the closing bracket of the primes() coroutine, even if I move it above main. It's not EOF related.
ps: Thank you for fixing the original cppcoro and using a sane build system!
The text was updated successfully, but these errors were encountered:
I get an odd warning for the following code I made for testing the library:
My compiler output is the following:
I am not sure why that is. I do not use any switch statements at all.
The warning is always on the closing bracket of the primes() coroutine, even if I move it above main. It's not EOF related.
ps: Thank you for fixing the original cppcoro and using a sane build system!
The text was updated successfully, but these errors were encountered: