|
Blotto Skorzany posted:Since it's an online course, probably. Frankly I don't get why they'd go with C over C++ (enjoy casting back and forth with void* and friends to make generic data structures - and I say this as a C guy), but a data structures course is about the last place you'd want to use a language that lacks value semantics or explicit memory allocation. I like the way my undergrad did it. We had a more abstract "analysis of discrete structures" course which went over all the data structures and some algorithmic stuff both in the abstract (pseudocode/big-O) and with concrete implementation assignments in a managed language (Java, which I don't really like, but it worked). We also had a required "C and Unix Programming" course with that as a prerequisite which, aside from some shell scripting minutiae, could be described as "data structures: the fiddly bits edition." It allowed the course to be more stringent about memory management. For instance, in the class I'm TAing, we're not worrying about memory leaks. In the C course I took in my undergrad, since we were expected to know how the various structures we were using worked, we had added constraints like the fact that no matter how complex our project was, valgrind had to exit cleanly. It also allowed both classes to have more complex projects. We had some hardcore tree stuff in the abstract course, and since you were expected to know how all the data structures worked in the C course, we could do interesting things with them. The class I'm TAing is very much an abstract course, and the texts were using are deliberately pseudocodey and non-language specific. We're just using C because our school uses C (and, rarely, C++) for 100-200 level courses. The memory management aspect of data structures isn't emphasized, other than the fact that they have to use malloc instead of realloc. Linear Zoetrope fucked around with this message at 21:00 on Jan 6, 2015 |
# ? Jan 6, 2015 20:56 |
|
|
# ? May 21, 2024 06:13 |
|
QuarkJets posted:Using superscripts/subscripts to denote upper/lower bounds on an integral feels intuitive to non-CS majors, a majority of LaTeX users, and there's literally no other reason to use a superscript/subscript on an integral sign. This might be a horror to someone who designs computer languages, but it's also a helpful feature for users. It didn't feel intuitive to me when I wasn't a CS major (actually I've never been one). Most people are going to have to look it up anyway, and things tend to be more intuitive and easier to remember when they're consistent: \frac, \sqrt, \sin \emph etc. all take arguments in curly braces, but this one doesn't. Zopotantor posted:The "\int_a^b" notation is inherited from base TeX, while "\frac" is LaTeX specific. That makes sense in terms of how that came about, although nowadays it's mostly used in displayed formulas. It still seems like a wart to me. Maybe it would have been nice if LaTeX defined it's own integral command that looks more like the rest of the new commands and left the old one as is or something.
|
# ? Jan 6, 2015 22:00 |
|
Starting working in my first programming job. I found this gem. code:
|
# ? Jan 6, 2015 22:32 |
|
The weird use of the switch statement aside, if it's 6 or higher then it defaults instead of hitting the "4 or less" exception? Nice!
|
# ? Jan 6, 2015 22:39 |
One is great, two is okay, three is nice, four is fine, five is RIGHT OUT (six and everything after is okay.)
|
|
# ? Jan 6, 2015 22:58 |
|
LazyArtifact posted:Starting working in my first programming job. I found this gem. That || thing there looks like a ghetto XOR to me. (a) || ((!a) && (b)) should act like a ^ b.
|
# ? Jan 6, 2015 23:22 |
|
LeftistMuslimObama posted:That || thing there looks like a ghetto XOR to me. (a) || ((!a) && (b)) should act like a ^ b. Not quite. XOR is (a && !b) || (!a && b), so it'd be equivalent to a || (a ^ b). EDIT: Dessert Rose posted:Which is just a || b. I wrote the post you are now making and then took a closer look at what the results will be. Soricidus posted:The horrors are coming from inside the thread The Laplace Demon fucked around with this message at 04:03 on Jan 7, 2015 |
# ? Jan 6, 2015 23:28 |
|
The Laplace Demon posted:Not quite. XOR is (a && !b) || (!a && b), so it'd be equivalent to a || (a ^ b). Which is just a || b. I wrote the post you are now making and then took a closer look at what the results will be. For us to be evaluating (a ^ b), a has to be false, which means all that matters is the value of b. If a is true then we don't check b; if a is false then we return the value of b. Therefore, a || b.
|
# ? Jan 6, 2015 23:34 |
|
I don't know. Maybe I'm going insane too. I thought it just simplified to a || b? https://dotnetfiddle.net/qDAEYH
|
# ? Jan 6, 2015 23:35 |
|
The horrors are coming from inside the thread
|
# ? Jan 6, 2015 23:57 |
|
Yeah guys it's just a convoluted way to say A || B and that guy should be fired (out of a cannon, etc) http://www.wolframalpha.com/input/?i=a+%7C%7C+%28%21a+%26%26+b%29
|
# ? Jan 7, 2015 00:10 |
|
A patch from our SoC vendor:C++ code:
|
# ? Jan 7, 2015 02:21 |
|
Suspicious Dish posted:
Hey everyone, anyone know what kind of resolution this case might support? I can't tell without the comments.
|
# ? Jan 7, 2015 02:27 |
|
EAT THE EGGS RICOLA posted:Hey everyone, anyone know what kind of resolution this case might support? I can't tell without the comments. My favorite comments are the ones like code:
|
# ? Jan 7, 2015 02:30 |
|
Jsor posted:My favorite comments are the ones like itym code:
|
# ? Jan 7, 2015 04:15 |
|
HappyHippo posted:That makes sense in terms of how that came about, although nowadays it's mostly used in displayed formulas. It still seems like a wart to me. Maybe it would have been nice if LaTeX defined it's own integral command that looks more like the rest of the new commands and left the old one as is or something. LaTeX is pretty much nothing but a giant mass of historical warts.
|
# ? Jan 7, 2015 04:22 |
|
Suspicious Dish posted:A patch from our SoC vendor: Vendors, vendors never change.
|
# ? Jan 7, 2015 04:31 |
|
Plorkyeran posted:LaTeX is pretty much nothing but a giant mass of historical warts. Also TeX itself is not really a programming language; it's almost all macro expansion and text substitution, with a few special horrors like \expandafter thrown in.
|
# ? Jan 7, 2015 07:20 |
|
Suspicious Dish posted:A patch from our SoC vendor: It probably came with strong guarantees that it's fixing whatever problem you complained about?
|
# ? Jan 7, 2015 08:16 |
|
Skuto posted:It probably came with strong guarantees that it's fixing whatever problem you complained about? It came as an attachment to an MS Outlook email with no body text and a subject line of "fix issue"
|
# ? Jan 7, 2015 10:02 |
|
Suspicious Dish posted:A patch from our SoC vendor: *cuts forearm* We are blood brothers, now
|
# ? Jan 7, 2015 14:50 |
|
Did you edit out anything, or is that literally doing nothing?
|
# ? Jan 7, 2015 14:59 |
|
itskage posted:Did you edit out anything, or is that literally doing nothing? Coding horrors: post the code that makes you laugh (or cry)
|
# ? Jan 7, 2015 17:56 |
|
Could it be a workaround for some embedded toolchain compiler bug?
|
# ? Jan 7, 2015 18:31 |
|
Munkeymon posted:Could it be a workaround for some embedded toolchain compiler bug? GCC for embedded architectures often tends to be an outdated version full of weird bugs. But from experience, no, I don't think that is it.
|
# ? Jan 7, 2015 18:36 |
|
Munkeymon posted:Could it be a workaround for some embedded toolchain compiler bug? We use a standard upstream ARM gcc. This is a patch to the Linux kernel, after all.
|
# ? Jan 7, 2015 19:09 |
|
I'm beginning to think that the way colleges teach CS - or at least programming - is a horror itself. Doing a bunch of reading lately, I ended up getting pointed towards ye olde Lisp - specifically, Scheme. I've been learning it over this past week (via Racket implementation), and it seems a hell of a lot more useful for teaching than loving C/C++ or Java.
|
# ? Jan 7, 2015 19:26 |
|
Suspicious Dish posted:A patch from our SoC vendor: I love vendor HDMI drivers. You should take a look at the imx6 hdmi linux stack. Im curious why they just didn't put a return at the top and call it good. edit* Here is the same function from a different (older version perhaps?) kernel? code:
Edit* There's just so much wrong in that function. Jesus christ Amlogic. FlapYoJacks fucked around with this message at 19:37 on Jan 7, 2015 |
# ? Jan 7, 2015 19:28 |
|
Tell me there's more to that patch and this was some incidental thing where they had to insert a case for the new enum value to pass code review. edit: lol code review on that
|
# ? Jan 7, 2015 19:28 |
|
sund posted:Tell me there's more to that patch and this was some incidental thing where they had to insert a case for the new enum value to pass code review. The local 'vic' is an int rather than an enum, so they won't get a compiler warning about unhandled values in the switch (the default case also prevents this, even if it vic were an instance of an enumerated type). This of course is a lesser issue than the function doing nothing in all cases.
|
# ? Jan 7, 2015 19:36 |
|
Linux? How does the MAINTAINER even accept that poo poo? Sure, that kind of code is common in SoC vendor trees because holy poo poo they can't write good code. But that's not supposed to make upstream at all.
|
# ? Jan 7, 2015 19:46 |
|
ratbert90 posted:Edit* There's just so much wrong in that function. Jesus christ Amlogic. Have one more: C++ code:
|
# ? Jan 7, 2015 19:47 |
|
ExcessBLarg! posted:Linux? How does the MAINTAINER even accept that poo poo? It isn't upstream. No Kernel maintainer in their right mind would ever ever EVER accept that pile of poo poo. Welcome to the wonderful world of SOC Kernel forks! edit* Suspicious Dish posted:Have one more: This is a thing of beauty! I wish I had the touch screen drivers on hand at the place I work at (not right now, no hours. [ If you need a embedded linux engineer I am willing to relocate. ] ) They where a piece of work. It had at least 4 functions to initialize the driver. Three of those functions just checked the variables passed to the function and called another init function with the same variables. FlapYoJacks fucked around with this message at 20:02 on Jan 7, 2015 |
# ? Jan 7, 2015 19:56 |
|
Suspicious Dish posted:We use a standard upstream ARM gcc. This is a patch to the Linux kernel, after all. Oh
|
# ? Jan 7, 2015 20:37 |
|
Blotto Skorzany posted:The local 'vic' is an int rather than an enum, so they won't get a compiler warning about unhandled values in the switch (the default case also prevents this, even if it vic were an instance of an enumerated type). There's a more specific warning -Wswitch-enum which will complain about missing cases even in the presence of default, although of course the index still has to be an enum.
|
# ? Jan 7, 2015 20:38 |
|
Anyone find anything good from the new year? (Besides Twitter!)code:
But this what I was given to resolve the issue temporarily so the system still works seamlessly for the users. It works... it just makes me cry. itskage fucked around with this message at 21:50 on Jan 7, 2015 |
# ? Jan 7, 2015 20:50 |
|
ratbert90 posted:If you need a embedded linux engineer I am willing to relocate. We're in SF. If you're serious, send me a PM and I'll tell you more about the gig.
|
# ? Jan 7, 2015 21:01 |
|
Suspicious Dish posted:We're in SF. If you're serious, send me a PM and I'll tell you more about the gig. I sent you a PM. Thanks!
|
# ? Jan 7, 2015 21:37 |
|
itskage posted:Anyone find anything good from the new year? (Besides Twitter!) I like that lonely little semicolon there.
|
# ? Jan 7, 2015 21:49 |
|
|
# ? May 21, 2024 06:13 |
|
That's actually best practice. quote:Always place a semicolon ( ; ) on an empty line in front of the first statement in your code (after the variable declarations). http://msdn.microsoft.com/en-us/library/aa636895%28v=ax.50%29.aspx No longer best practice in AX 2012 though.
|
# ? Jan 7, 2015 21:53 |