|
HardDisk posted:
C array notation is mostly syntactic sugar. The following two expressions are defined to have identical meanings: code:
|
# ¿ Jun 18, 2015 22:03 |
|
|
# ¿ May 17, 2024 20:13 |
|
nielsm posted:fooficate(x * -invert) That does something different.
|
# ¿ Jul 3, 2015 20:00 |
|
Biowarfare posted:Copy of terraria (2) real.cs.bak version control
|
# ¿ Jul 8, 2015 20:25 |
|
loinburger posted:He probably has sexual fantasies about his mother, but then again, who doesn't. s/his/your/
|
# ¿ Jul 15, 2015 17:24 |
|
APL, eh?quote:Rho, rho, rho of X
|
# ¿ Jul 30, 2015 21:14 |
|
ExcessBLarg! posted:I'm guilty of using parentheses with "function-like" keywords like sizeof. It's a little weird, although not entirely uncommon to smash control flow keywords (if, for, while) against the condition parenthesis. Common C style guides (KNF/style(9) and Linux kernel) do include space there, I think in part to distinguish them from function calls, but also because those keywords also introduce expression blocks anyways. If you merely put an if/for/while against a parenthesis, I will frown at your code and move on. If you do this, however, I will curse you and your descendants to the seventh generation: code:
|
# ¿ Sep 10, 2015 20:34 |
|
Xarn posted:Yeah, my work is at C++03 in name of portability... For me it's backwards compatibility. So far RedHat refuses to guarantee that the C++11 ABI in RHEL 7 will remain stable.
|
# ¿ Oct 14, 2015 16:29 |
|
Ant Attack was pretty rad.
|
# ¿ Oct 16, 2015 21:16 |
|
Pavlov posted:Pff, are you saying you don't browse by just curl-ing the pagesource? Look at this poser. Telnet to port 80 and type in your GET request.
|
# ¿ Oct 22, 2015 21:29 |
|
Hammerite posted:I still don't understand why you'd use #define rather than using const variables for the constants and functions for the macros-with-arguments. One reason for using macros in preference to functions is that when you use __FILE__ and __LINE__ inside a macro, they refer to the location where the macro is used. This is really handy for tracking down bugs using a log of HW register reads & writes. To do something similar with a function, you'd have to pass __FILE__ & __LINE__ to every invocation.
|
# ¿ Oct 28, 2015 22:32 |
|
Carbon dioxide posted:Holy crap. Sounds suspiciously like Ken Thompson's scenario (Reflections on Trusting Trust). Does anybody know where or when this supposedly happened?
|
# ¿ Nov 22, 2015 13:22 |
|
Soricidus posted:There's no point modifying the compiler on a single computer unless it's the build server that produces os updates, unless we're talking some os that delivers updates only in source form, which seems kinda unlikely even in the 1980s? Tip: If you can get your hands on Thomas J. Ryan's The Adolescence of P-1, do so. It's long out of print, the premise is ridiculous, but it's a neat read. It also has the greatest (IMHO) last line in literary history. Wikipedia. Warning: Spoilers the whole thing, including the final gag.
|
# ¿ Nov 23, 2015 06:41 |
|
xzzy posted:listserv is the coding horror, I've never liked the idea of sending commands by sending an email to a special address. Email is for messages, not controlling software. Ftpmail was a godsend when I was behind a corporate firewall, before SOCKS came around.
|
# ¿ Dec 20, 2015 23:16 |
|
Karate Bastard posted:This is a good time to post this: This guy knows. However: quote:THERE IS NO HARDWARE ARCHITECTURE THAT IS ALIGNED ON 7.
|
# ¿ Dec 24, 2015 11:53 |
|
ratbert90 posted:Strewn about the project I inherited are C files, in these C files are bullshit like this: Seriously, apart from the brace placement and missing error checks this is perfectly clear and even nicely documented. Every one of these statements has a purpose. You just seem to lack the information needed to understand why someone would want something like it. As far as I can tell, this is intended to start a daemon process, avoiding several pitfalls caused by various warts of UNIX-like systems: - The chdir avoids leaving a reference to the original working directory. - Closing all file descriptors (portably, even) similarly avoids leaving references to other files, and prevents information to leak to the started process. - setsid prevents signals to be propagated from the parent's process group to the new daemon (think Ctrl-C). - I think the setuid is to make the process run as the real root user; I assume that the program will have its setuid bit set to make this work. Finally, chkconfig is a utility that installs a symbolic link to a startup script to be run at boot time, and the last statement runs that script explicitly so the daemon starts up immediately.
|
# ¿ Jan 20, 2016 21:45 |
|
Dr. Stab posted:Yeah, I don't really get it. If anything single point of return takes more effort to trace. Nah, just do this: code:
|
# ¿ Feb 29, 2016 22:07 |
|
Shinku ABOOKEN posted:Name and shame. The UK also has insane libel laws, so better not.
|
# ¿ Mar 31, 2016 20:57 |
|
YeOldeButchere posted:That's kinda similar to the way dynamically allocated arrays are implemented in most C++ compilers, really. Get a block of memory slightly larger than what you need, stick the number of elements in the array at the beginning, and return a pointer to the first array element to the user. cfront on HP-UX used to do it differently. It stored the array size in a separately allocated block of memory, causing a slow memory leak when you deleted an array using the non-array delete operator. (This was ~25 years ago, I may not remember the details correctly.)
|
# ¿ Apr 1, 2016 17:10 |
|
Suspicious Dish posted:C++ has order-of-magnitude-longer compilation times and isn't easily bindable to other languages because of name mangling. Qt, the competitive toolkit, requires a custom preprocessor to even make C++ usable for their use case. Also, C++ is really, really lovely for creating libraries that need to be separately compiled, if you also want clients of the library to derive from the interface classes. This was one of the main problems with the BeOS API (which was very nice otherwise), "solved" by stuffing the interfaces full of dummy member variables and virtual functions.
|
# ¿ Apr 27, 2016 05:46 |
|
Munkeymon posted:Cuntpunch said he started out of nowhere, which points to it not being that insipid habit. Perhaps he read the reader letter in a recent CACM which advertised this as a good idea. it isn't when the compiler doesn't enforce it and the next merge scrambles your oh so carefully maintained comments
|
# ¿ May 6, 2016 08:14 |
|
JawnV6 posted:Neither does "wait for the TX interrupt bit to be unset" but that generally trips the "no empty loops" condition. But I'm pretty sure breaking that out into That would fail code review at my workplace because it's missing a timeout check for when the hardware breaks and the bit remains stuck.
|
# ¿ May 31, 2016 17:06 |
|
Drangus McCafferty posted:How about explicit message passing? That's still not primitive enough, since it also returns something. Use actors or continuations. Don't judge me, I read some of the old lambda papers a week ago.
|
# ¿ Jun 7, 2016 05:39 |
|
quiggy posted:Every language is just syntactic sugar for subleq. mov is Turing complete (PDF) quote:Thus, while it has been known for quite some time that x86 has far too many instructions, we can now contribute the novel result that it also has far too many registers.
|
# ¿ Jun 9, 2016 19:24 |
|
weird posted:are there any languages other than lisp that do Does Forth, technically.
|
# ¿ Jun 19, 2016 01:06 |
|
HappyHippo posted:Because it's probably the most byzantine language ever created. Verity Stob posted:Whereas smaller computer languages have features designed into them, C++ is unusual in having a whole swathe of functionality discovered, like a tract of 19th century Africa.
|
# ¿ Jun 21, 2016 05:45 |
|
fleshweasel posted:Swift is great and actually useful if you happen to be doing apple stuff. Oh hi, language which treats the first parameter of a function call differently than the rest. Just kidding, I like Swift. But no language is perfect.
|
# ¿ Jun 27, 2016 16:55 |
|
Carbon dioxide posted:We're gonna run out of helium to cool the MRIs before this shitstorm is fixed. Good news!
|
# ¿ Jul 5, 2016 06:07 |
|
hackbunny posted:Coding horrors: Strong typing means pressing your keyboard keys very hard
|
# ¿ Jul 19, 2016 21:53 |
|
rarbatrol posted:Recently a guy at work accidentally (nobody has any idea how) deleted 1/2 of our code base in one commit with a message like "lol idk why this is happening this is weird" and then rolled it back with the next commit. hosed up his worktree and didn't know how to fix it?
|
# ¿ Aug 19, 2016 05:54 |
|
TooMuchAbstraction posted:The real horror is that you forgot that quux comes after baz. Heretics! It's "foo, bar, baz, zip, qux, quux, quuux, ..."
|
# ¿ Sep 16, 2016 06:21 |
|
TooMuchAbstraction posted:Something like a decade ago I watched a talk given by a programmer who got carpal tunnel syndrome but still needed to be able to code. During what little "real typing" time he had each day, he hacked one of the more modder-friendly voice recognition tools to add a bunch of special "words" that corresponded to actions and symbols that are common in programming but not in normal text. Like, "zzp" mean { and "pzz" meant }, and he had words for un/indenting, creating a ( ) and moving to the interior of the parens, etc. https://www.youtube.com/watch?v=lQ91SVKryYU
|
# ¿ Nov 17, 2016 22:01 |
|
QuarkJets posted:Looked around online and apparently this is a common problem with Matlab-compiled standalone executables, there is no solution and you just have to deal with it Hey, at least you're not using it to design ASICs. That chip has more revisions than any of our other ones, and that includes the one where the main PLL had its output shorted to ground...
|
# ¿ Jan 8, 2017 09:41 |
|
Jethro posted:The vast majority of the time users will enter data into a spreadsheet as a string representation, but then they want it to be treated as data, not a string. So it makes perfect sense to take strings that look like numbers, dates, or times and automatically convert them to numbers, dates, or times respectively. An alarming number of scientific papers contain Excel errors.
|
# ¿ Mar 29, 2017 18:42 |
|
hyphz posted:So, have you heard of the ZX Spectrum Next? It's a Euro-UK-ish project to restore the ZX Spectrum, one of the classic older games machines, using an FPGA-based board - but with a faster clock speed and a bunch of extra features. One of the extra features is hardware sprites. IIRC the Spectrum's ROM (at least the extended Interface 1 version) actually used the 16-bit feature.
|
# ¿ Jun 5, 2017 19:41 |
|
This seems to be type correct, I see no problem.
|
# ¿ Jun 17, 2017 07:12 |
|
NihilCredo posted:Yes. Yes what? Yes, sir! Sorry, old Prolog joke.
|
# ¿ Aug 12, 2017 12:59 |
|
my girlfriend is Legos posted:I'm writing some front end stuff for a partner of ours and found a bit of a peculiarity about their API. After first trying it out and fetching some data, on a hunch I decided to check the UNIX timestamp it returned. Sure enough, it was off by two hours. Their server is located in CET, so I figured they probably accidentally used DateTime.Now instead of DateTime.UtcNow when generating the timestamp. Fair enough, I guess that's an understandable mistake. I asked one of their developers if he knew about it, and turns out that nope, it was a very deliberate decision to return an integer named 'Time' that looks exactly like a UNIX timestamp but is secretly the server's local time minus 1/1 1970 00:00 UTC and thus doesn't conform to standard, because "in 99% of cases you want local time". What do they on the switch to/from daylight savings time?
|
# ¿ Aug 20, 2017 18:09 |
|
Ranzear posted:I was more responding to this part of your gripes, not the goto part. If you extract the methods of a classical object into static functions (and pass the appropriate object back into it) you can do procedural or even functional programming on fairly discrete data. There's no real need to return anything because you're just passing a big ol' chunk of state around.
|
# ¿ Aug 27, 2017 08:30 |
|
Jabor posted:Suffice to say that no, cloning the same remote into multiple different local repositories is not common git practice at all. It is if you're working on multiple branches, and switching branches entails a 2+ hour recompile...
|
# ¿ Sep 2, 2017 09:04 |
|
|
# ¿ May 17, 2024 20:13 |
|
Linear Zoetrope posted:I assume the branch switch changes some fundamental files everything else references so it can't reuse object/intermediate files from the other branch? Interface definitions & headers, yeah. We have gotten better lately, there are actually people working on improving build times now.
|
# ¿ Sep 2, 2017 09:24 |