chris
how do u known are 10?
The professor said.
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
Anonymous
popen
thanks
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?
Patrick
Damn. Is there anyway to get the size of its return type?
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
And that's completely static?
What do you mean by static?
Anonymous
And that's completely static?
yes. sizeof is totally compile time; except for variably modified types
Anonymous
Anonymous
What are "variably modified types"?
type of a variable length array
Anonymous
type of a variable length array
It's illegal in C++ though
Anonymous
I suppose it makes sense that you have to provide parameters due to overloading
It makes sense where there's no overloading either sizeof calculates expression type and then calculates it's size
Anonymous
Expression type of just function name is pointer to the function
BLK
Hi all
klimi
hi
Anonymous
Hi all
Nohello.com
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?
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
1) Your function parameter is function pointer with signature you need. But you cannot pass lambdas with captures
While VSC thinks it's correct syntax GCC doesn't compile it (thus far when I try it)
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
it's a closure
Well, you cannot pass closures as function pointers
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)>
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
Artöm
Do not use globals
Arduiono can be considered embedded, so globals are way to go
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.
MilkBeforeCereal
you will get limited very soon
I am limited to chu uwu
Anonymous
I couldn't understand what you meant by that.
Dima
lol