Bader
so just wondering if anyone had any quick tips 😁
Bader
it'll be used in conjunction with the Arduino IDE and stuff
Alignant
such a long function
Yeah, and guess what... this library has a function that accepts a pointer
hostmit
or cant I? I can prolly make a copy inside recepient fucntion... and make sure acquire will delete original pointer like in a 3 sec
Alignant
Do you like that? :D
BinaryByter
pointers are okay in some cases
my code for clinl is full of them
hostmit
why?
hostmit
am I that bad? :)
Roxifλsz 🇱🇹
so just wondering if anyone had any quick tips 😁
Oh in that case, just develop the library, and when you have a very specific question/problem ask here. Actually, I'm developing for an esp8266 right now
BinaryByter
am I that bad? :)
please split that function up into as many small functions as you can
BinaryByter
also, split your class into subclasses
BinaryByter
also, split your class into subclasses
i assume that your class is wayy to big
Dima
The people who hate cxx just can’t figure out how it works
Dima
The only reason is that one.
Dima
Or typical js coderz
hostmit
My C++ experience like 5 days :) I understand it has really different "Best Practices" apart from Node, C# :D
BinaryByter
yes
theres no reason to use C++ over C except for some edge cases @ollirz will point out for you
BinaryByter
My C++ experience like 5 days :) I understand it has really different "Best Practices" apart from Node, C# :D
No, it's just that Node and C# don't have a lot of good coders who enforce good practices
BinaryByter
you NEVER want your function to be longer than 20 lines
hostmit
cause C++ doesnt allow nested fucntions :D
BinaryByter
it does
hostmit
does it?
BinaryByter
yes
hostmit
well subclasses maybe. void function () { void subfunction(){} } will yeld error
BinaryByter
you can have nested funcitons
BinaryByter
except they have a different syntax
BinaryByter
(because they are lambdas)
BinaryByter
void functiony () { auto f2 = [] () { }; f2(); }
hostmit
okey, so I that's like 3rd time I meat that word :) have to google for
Ибраги́м
am I that bad? :)
Everybody needs improvement, even those sitting @ ISO C++ Committe High chair. YEs, Bjarne included.
hostmit
yeah! castsing is hell! it was like whaaaat??? u cant do string = char[]+char[]? :D
BinaryByter
why would you want to add two pointers?
hostmit
it was later I learned array = pointer
hostmit
would someone link me Arduino/Esp specific telegram channels?
Ибраги́м
imho those casts should be changed
I'm more concerned about myArr and the trouble it will cause if NOT tamed well
BinaryByter
myArr whats that?
hostmit
he reffering to my code :)
hostmit
the way I used to pass data to void* accepting function :D
Dima
Lol
Dima
hostmit
how do I stop gif from autoplaying? :)
klimi
wel...
Ибраги́м
What does gpio_isr_handler_add do ?
Ибраги́м
hostmit
attach handler to GPIO on board. on change - it will fire up handleInterrupt()
hostmit
hostmit
oh boy I will get blamed again :)
hostmit
this function will be executed on GPIO change. I need to know which GPIO caused this function to invoke
hostmit
I've seen other, non working examples, ppl try to pass pointer to struct or vector, without calling "new" operator.
BinaryByter
split the function!
hostmit
On rare ocassions, app will deattach handler and reattach new one. I dont think few "floating" int[3] arrays will eat up all memmory... more like a learning case how to solve this.
hostmit
split? why? how? may I see solid example?
BinaryByter
split? why? how? may I see solid example?
how about making the loop an own function?
Ибраги́м
http://share2.hostmit.net/ss/Code_2018-09-01_22-42-53.png
Dang it! Can't you just use int arr[3], or it has to be dynamically allocated ?
klimi
and i thought anyone needs me
BinaryByter
I do
hostmit
no, cause by the time it get's to recepient function, caller is finished, memorry cleared, only 0 at that address
klimi
I do
i dont want more work
BinaryByter
no I meant
BinaryByter
I need you as a close friend :)
Ибраги́м
hostmit
I could probably could pass pointer to Classes's property (stuct) I have for each pin.
hostmit
I think I got solution. For every active GPIO i have own struct (few ints). Unless pin active - it always has that stuct. Before removing PIN from config, I remove all handlers... so I can do like this
hostmit
Ибраги́м
Wait it's the same data[]
hostmit
actually array of stucts, but doesnt matter. I will be sending Object static property
hostmit
yeah. the same I was getting values to happy myArray :D
Ибраги́м
yeah. the same I was getting values to happy myArray :D
I belive you can put in the same function
Dima
O, I see AOS, think about data oriented approach
hostmit
well, that's Arduino... I dont have std:: implemented... vector partially