pdn
chris
Anonymous
hi all
Anonymous
just wondering on C i'm very new at it but how would i print the output of system()?
Anonymous
Hello developer and student
What is your average age and education
Artöm
Anonymous
Darknez
/saved
Nikk
P#awesomeness
Nikk
#awesomeness
Nikk
#best
Nikk
#best-book
Nikk
#india
Asdew
Oh, darn it, I missed the person to contact from that scam, I wanted to troll the scammer like I am trolling one right now.
Patrick
If I use sizeof(function) does it return the size of the function's return type or something else?
Anonymous
Patrick
Damn. Is there anyway to get the size of its return type?
Anonymous
Anonymous
Anonymous
sizeof(func(...))
Patrick
And that's completely static?
Patrick
I suppose it makes sense that you have to provide parameters due to overloading
Anonymous
Anonymous
Anonymous
Anonymous
Expression type of just function name is pointer to the function
BLK
Hi all
klimi
hi
Anonymous
Patrick
I'm having to use a C++ version below 14, so I can't use auto in a lambda parameter.
How do I write const lambda []void (uint8_t*, uint8_t)->void as a parameter type?
Patrick
Anonymous
Anonymous
Lambdas types are not exposed to programmer
Anonymous
And every lambda has its own unique type
Anonymous
But there's some possibility
Anonymous
There are two, actually
Anonymous
1) Your function parameter is function pointer with signature you need. But you cannot pass lambdas with captures
Patrick
Anonymous
2) Your function parameter is std::function with signature you need.
You can pass lambdas with captures but it has a little overhead
Anonymous
Patrick
that'll be a little difficult, but I'll try make a minimal version of it
Anonymous
It is correct syntax since by C++ standard lambdas with no capture can be implicitly casted to function pointer
Patrick
it's a closure
Patrick
auto appender = [&] (const char* path) {
return [&h, path] (uint8_t* data, uint8_t len) -> void
{ h->fileAppend(path, data, len); };
};
const auto binOut = appender("entry.bin");
It's small. Just later passing binOut to another lambda.
Anonymous
So the only way is to use std::function
Patrick
Gahhh, that sucks
Patrick
I can't afford the overhead so I'll probably have to use a global
Anonymous
std::function<void(uint8_t*, unit8_t)>
Anonymous
Patrick
it's for Arduino
Patrick
I'm being cheeky as it is using closures
Anonymous
Arduino has no C++14 support?
Patrick
It will vary between board architecture
Anonymous
Can clang compile to Arduino?
Patrick
Not sure about that. Regardless though, I'm trying to provide frictionless compilation with just the Arduino IDE so I've got to stay rather compatible
Anonymous
Meh
Patrick
I could just tweak the platform spec and see what happens but I can't ask end users to do that 😅
Anonymous
Do not use globals
Anonymous
Implement your functionality with classes
Patrick
I didn't quite mean global, as it's all within one method already
Artöm
Ofc only when its very hard/inconvenient to do it other way
Patrick
so, a local they both the caller and callee are within scope of
Patrick
but now I'm not sure what type to give the local 😂
Patrick
I should probablyyyyy go about this without any lambda, unfortunately
Sher
Any books and tutorials on socket programming in c/c++, (already searched on Google, only found example programs). Thanks in advance
Artöm
man select
Sher
Please Any books and tutorials on socket programming in c/c++, (already searched on Google, only found example programs). Thanks in advance.
Anonymous
Sher
Anonymous
klimi
MilkBeforeCereal
Anonymous
Anonymous
I couldn't understand what you meant by that.
Dima
lol