Go Down

Topic: (Bar sport) Do you Google C++ code to cut and paste? (Read 1 time) previous topic - next topic

curious48

Jul 27, 2016, 11:02 pm Last Edit: Jul 27, 2016, 11:03 pm by curious48
When you're trying to apply some algorithm and are thinking maybe there is some code you could snatch for it, do you google C++ code to cut and paste? (do you literally put "c++" / "c++ example" etc into a google query), and try to find someone who has written exactly that code sample)?

I mean for esoteric sorts, filters, running averages, HyperLogLog, etc.

This question is without any value which is why it's in bar sport "Jokes, mobs, and all sorts of unrelated topics."
Are you curious about the intersection of Arduino/Electronics/Raspberry Pi/Orange Pi/Beaglebone/niche manufacturing/starting from 0 and scaling?  Try: http://curious.boards.net

pYro_65

You should be looking at other peoples code. You'll learn a lot more, and faster. As not everyone thinks the same, you might see some solution you haven't thought of, or a concept which you have to go learn even more to understand.

Oh, and if you copy code, at least ensure you put a comment with it containing a link to the source of it, with the Authors name if applicable, so others can search for documentation and such.

Also remember, under copyright law, any code without a licence or copyright info is not usable. So if your Arduino hobby makes you a million, ensure none of the unlicensed stuff remains in your code.
Forum Mod anyone?
https://arduino.land/Moduino/

Delta_G

I will take code from other places, but not as a blind copy and paste.  I'll only use a piece of code if I can understand how it works and what each line does.  If not, I'll study up before I take it.  The surest route to disaster in coding is stitching together a bunch of code you don't understand. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

ChrisTenone

No. If I am looking for randomly written code through Google (or whatever) I do not put c++ in the search terms. I use the word "arduino" instead. Now this may support your contention that "arduino" is a language onto itself, or at least a dialect. (yep, I suspect that you are a linguist) It does not.

The search term "arduino" will return sources that mention the term or that are closely associated with the term. As Arduino programs are written in C++, the results will heavily favor C++ code. Additionally the presumed hardware (as most projects are hardware projects, using software only as a necessary evil - well, maybe evil is too strong a term) of such a search will mostly be Arduino projects, that I can reproduce on my Arduino equipment without much trouble.

If there were a language that I could use, other than C++ for an uploadable, runable, Arduino sketch, then I would surely love to use it! (Just for you know, the thrill.) There is no reason it could not be done* but so far, I have not seen it.


*I am aware of Forth interpreters that can be loaded onto an Arduino board. I have not yet been successful in getting one of those to run in a way that I can use it.
I'm not disparaging the differently abled. It's just that thirty years of community college has literally made me mentally retarded.

westfw

Quote
I mean for esoteric sorts, filters, running averages, HyperLogLog, etc.
You might be surprised at how rare it is to actually use those sorts of things...
I spent essentially an entire career without using floating point.

If I want cut-and-paste code for an Arduino, I search for Arduino.  For cut and paste, you need to be as specific about the target environment as possible.  For example, there is https://github.com/WestfW/ArduScan is C++ for windows that has some pretty-much cut&pasted code, and when I was searching for how it might be done, I sure as heck included "windows" in the search terms and not just C++ (clearly showing that it was written in "Windows system development language", and not "just C++"; I wonder why they bother calling it C++? :-; )

If I want an implementation of a fancy algorithm, I usually don't specify a language, nor do I expect cut-and-paste level code.  This is one reason that someone who wants to be a "programmer" needs to understand several different languages.


msssltd

(do you literally put "c++" / "c++ example" etc into a google query)
No.  I literally use "cplusplus"  but only search for C++ source to check syntax or find standard library functions.  I never c&p verbatim.  When I can not get my head around an alogorithm, I will prototype in BASIC or Pascal and transcribe to C++ when I know what I am doing.



Go Up