Amazon's CodeWhisperer
Amazon's CodeWhisperer
Posted Jul 6, 2022 11:15 UTC (Wed) by farnz (subscriber, #17727)In reply to: Amazon's CodeWhisperer by nim-nim
Parent article: Amazon's CodeWhisperer
Copyright is intended to protect creative expression. If there are only a limited number of ways to express something, then the resulting expression may not qualify for copyright protection - e.g. in C++11 code, there's only a few plausible ways[1] to check that a std::string is empty, and using one of those is unlikely to be protected by copyright even if it's a direct copy and paste from another code base.
[1] Two possible ways to get size of string natively and compare to 0. The empty() method. Using c_str() or data() and then checking to see if the pointer points to NULL, or using strlen() to check the C string length. Comparing for equality to an empty string constant via either operator==() or compare().
And of course, there's the implausible ways that might conceivably be enough to get copyright protection depending on context - using find_first_not_of or find_last_not_of to find a character not in the empty string.
Posted Jul 6, 2022 15:09 UTC (Wed)
by khim (subscriber, #9252)
[Link]
Code tends to be at odds with copyrightability: if what you writing is convoluted enough is convoluted enough to warrant copyright protection then very often it's convoluted enough to perform badly. There are always some exceptions like 0x5f3759df: if you are using that then you maybe violating copyright, but if you use 0x5f375a86 (which is simply the best constant for that algorithm) then you are not violating. But what if you want to compatible with some existing code? Quake, e.g.? Then you need 0x5f3759df to stay compatible! Ultimately problems like that mean that for every line of code you need court decision… which is not practical, obviously.
Amazon's CodeWhisperer