|
Look at all these people here posting about how great unions are, completely fearless about being fired for organizing.
|
# ? Jun 7, 2021 20:44 |
|
|
# ? May 26, 2024 22:19 |
|
Volmarias posted:Look at all these people here posting about how great unions are, completely fearless about being fired for organizing. Don't worry we're all European.
|
# ? Jun 7, 2021 21:02 |
|
Volmarias posted:Look at all these people here posting about how great unions are, completely fearless about being fired for organizing. Oh no, are you part of a discriminated union?
|
# ? Jun 7, 2021 21:22 |
|
Brain Candy posted:Nah, tying your your serialization to an architecture and a particular compiler is usually a bad plan OP. I mean, there are literally two architectures anyone gives a poo poo about now, and the compiler will usually follow the architecture (and/or relevant ABI) when it comes to structure layout. Also, depending on what you're doing you may not care about cross-architecture or cross-compiler compatibility anyway.
|
# ? Jun 8, 2021 17:00 |
|
There are ways to ensure that your representation (for a network or file format, for instance, which you may not have control over the specification of) will be accurate for all architectures/compilers you care about, with compile-time verification. This argument usually comes down to "you should never need to care about the exact memory layout of your data" which is just patently false. There are lots of times when I need to do exactly that. I also don't need my programs to run on all possible architectures or build on all possible compilers. I need them to build on two architectures, with two compilers, for four operating systems. Those are very concrete numbers, and it's extremely possible to make your code explicitly refuse to compile if you're trying to build it for something else without describing how. No one is saying your front end webdev should use C-style unions, but not all of us are front end web devs.
|
# ? Jun 8, 2021 17:08 |
|
Foxfire_ posted:Using the same space to hold two different things in C/C++ is generally better accomplished with a char array and memcpys.
|
# ? Jun 8, 2021 17:20 |
|
more falafel please posted:I also don't need my programs to run on all possible architectures or build on all possible compilers. I need them to build on two architectures, with two compilers, for four operating systems. Those are very concrete numbers, and it's extremely possible to make your code explicitly refuse to compile if you're trying to build it for something else without describing how. Noone is saying nobody at all should care about this stuff, but there are some of us who need to build on one architecture, with one compiler, for one operating system, which are also very concrete numbers, and in that case this sort of thing can work just fine. Edit: wait, I think you're loudly agreeing with me anyway
|
# ? Jun 8, 2021 17:35 |
|
Converting from littelendian to bigendian seems to be quick. Once is set that a file format is written in one style, your code just convert it to the style you can read on the fly. https://stackoverflow.com/questions/13001183/how-to-read-little-endian-integers-from-file-in-c Is not a big issue, I think. Maybe is more a issue if you have to deal with random fragments of binary data of unknowm origin. That would only happen if you are ... I don't know,... reverse engineering videgames data files. But at that point you are already a hacker that can figure things by yourself.
|
# ? Jun 8, 2021 17:58 |
|
Tei posted:Converting from littelendian to bigendian seems to be quick. This is what I'm saying when I say there are only two architectures people care about any more - well, more accurately, three. X86-64 and ARM (Thumb if you're in microcontroller land, AArch64 if not). All of these are little endian. Little endian won. You will most likely never need to work with big endian hardware in 2021. The only reason we still have to care about it is that Sun were big endian and defined a bunch of internet protocols and apis in the 90s, hence all that htons/ntohs nonsense in libc. That's not all there is to worry about though, between alignment rules and e.g. what is sizeof(long int).
|
# ? Jun 8, 2021 18:09 |
|
feedmegin posted:This is what I'm saying when I say there are only two architectures people care about any more - well, more accurately, three. X86-64 and ARM (Thumb if you're in microcontroller land, AArch64 if not). All of these are little endian. Little endian won. You will most likely never need to work with big endian hardware in 2021. The only reason we still have to care about it is that Sun were big endian and defined a bunch of internet protocols and apis in the 90s, hence all that htons/ntohs nonsense in libc. Right, I still do have to care about endian sometimes (moreso in the last console generation, but it's still sometimes relevant for network transmission), but I generally speaking don't use "long int", I use "int32_t" or equivalent, depending on how big of an integer I want. These are defined in platform headers (and if they're not for some reason, they're trivial to define yourself). My point is that lots of "undefined behavior" is undefined by the language standards, not by the actual discrete tools/architectures/platforms you're using. The argument that you can't use these tools safely is the problem -- you just need to know precisely what is going to happen, which, in these situations, you already need to know.
|
# ? Jun 8, 2021 19:30 |
|
more falafel please posted:My point is that lots of "undefined behavior" is undefined by the language standards, not by the actual discrete tools/architectures/platforms you're using. The argument that you can't use these tools safely is the problem -- you just need to know precisely what is going to happen, which, in these situations, you already need to know. The reasoning is generally not because of uncertainty about what actually happens on the platform, it's for what can be assumed about the program. A compiler will have a library of optimizing transformation techniques that provably don't change the output under all inputs, but the proofs use assumptions that a legal program may never do some stuff. If you violate those assumptions, the transformed program might produce different output, sometimes. For example, signed integer overflow is undefined behavior in C. Any actual compiler knows what chip it's emitting assembly for and what actually happens on overflow. You still can't overflow a signed value in a C program and expect things to work because the optimizing transformations are designed with the assumption that "(X + 1) > X" is always true if X is signed. If you do overflow anyway, you might or might not get what you expect depending on if any transformation that got applied to that piece of code in particular relied on that assumption for its correctness.
|
# ? Jun 8, 2021 19:44 |
|
Type layout is not undefined, it's just implementation-defined. You can absolutely use C structs for precise binary layouts. Doing so does sometimes mean it'll take extra work to bring up a new port, but it's not necessarily less work than writing a byte-stream deserializer would've been. You can even make bit-fields work portably, although that can be a huge pain in the rear end and sometimes requires you to declare your bit-fields in a different order on different platforms.
|
# ? Jun 8, 2021 20:30 |
|
feedmegin posted:I mean, there are literally two architectures anyone gives a poo poo about now, and the compiler will usually follow the architecture (and/or relevant ABI) when it comes to structure layout. Also, depending on what you're doing you may not care about cross-architecture or cross-compiler compatibility anyway. I'm trying to retroactively convince whoever did this to me with twelve bit words to not.
|
# ? Jun 8, 2021 20:50 |
|
“Hey csammis, we need you to take over this feature. The guy who wrote it is gone and the guy who tried to fix it can’t get it finished.” It’s all C++-without-classes functions with no fewer than 21 parameters, some of which are references to pointers to objects with still more parameters. I think I know why the feature’s been orphaned
|
# ? Jun 21, 2021 20:23 |
|
csammis posted:“Hey csammis, we need you to take over this feature. The guy who wrote it is gone and the guy who tried to fix it can’t get it finished.” is there code review at your company?
|
# ? Jun 21, 2021 20:38 |
|
The person who approved the feature is also no longer with the company
|
# ? Jun 21, 2021 20:44 |
|
csammis posted:“Hey csammis, we need you to take over this feature. The guy who wrote it is gone and the guy who tried to fix it can’t get it finished.” On the plus side, it sounds like you have a great chance to refactor things. On the negative side, this sounds like a horrific house of cards except that the cards are actually spiders and there's almost certain to be pointer arithmetic in there that makes Assumptions about the nature of structs it is given. I hope you had a very delicate conversation with your boss about how this is going to require an outsized amount of time, either in fixing it, or completely rewriting it.
|
# ? Jun 22, 2021 06:57 |
|
csammis posted:“Hey csammis, we need you to take over this feature. The guy who wrote it is gone and the guy who tried to fix it can’t get it finished.” It sounds that code is pure poo poo. It started has something really bad, and then it was downhill from there. It would be fun to document how is actually used. Maybe you can mark the methods that are really in use. If more than two methods are in use, then is not this module, the whole codebase is dumb poo poo.
|
# ? Jun 22, 2021 07:30 |
|
When I use the wrong API key, the vendor I'm integrating with returns:code:
Ola fucked around with this message at 11:48 on Jun 22, 2021 |
# ? Jun 22, 2021 08:48 |
|
Didn’t even close his tags properly
|
# ? Jun 22, 2021 11:30 |
|
DoctorTristan posted:Didn’t even close his tags properly I knew I should have copy/pasted the actual thing.
|
# ? Jun 22, 2021 11:49 |
|
I'd say that's a perfectly fine QuirksMode response. The HTML spec is just a suggestion anyway, right?
|
# ? Jun 22, 2021 13:05 |
|
Volmarias posted:I hope you had a very delicate conversation with your boss about how this is going to require an outsized amount of time, either in fixing it, or completely rewriting it. In fact the opposite! It’s so loving bad that my boss convinced the product manager that it is absolutely critical that we refactor or rewrite this before adding the new pieces they want because multiple engineers have taken a stab at it and failed. It’s the textbook definition of unmaintainable and it’s a pretty important feature for the product. I was asked to be the fixer and given five months. Tei posted:It would be fun to document how is actually used. Maybe you can mark the methods that are really in use. This is how I started yesterday - I was hoping I could just begin by cutting entire chunks. No such luck. quote:the whole codebase is dumb poo poo. In all of the rest of my company’s engineers’ defense, the vast vast vast majority of our codebase does not look like this. The feature in question is thankfully not foundational. If it were,
|
# ? Jun 22, 2021 13:51 |
|
Morning status update from my offshore team: "Hey Protocol7. We had some issues updating rows in this table, so we removed the primary key and now everything's working." Yeah I'm sure that was the only option.
|
# ? Jun 22, 2021 15:50 |
|
Protocol7 posted:Morning status update from my offshore team: Please tell me there's a backup.
|
# ? Jun 22, 2021 15:51 |
|
Absurd Alhazred posted:Please tell me there's a backup. There is only one significant reason I have backups enabled and you're reading about it!
|
# ? Jun 22, 2021 15:52 |
|
- wow I'm bad at forums this morning
|
# ? Jun 22, 2021 15:52 |
|
Protocol7 posted:Morning status update from my offshore team:
|
# ? Jun 22, 2021 16:52 |
Protocol7 posted:"Hey Protocol7. We had some issues updating rows in this table, so we removed the primary key and now everything's working." In what universe is this a logical choice Like, I've worked with some iffy devs, but how in the goddamn gently caress
|
|
# ? Jun 22, 2021 16:55 |
|
"We had issues when deleting some rows, but the problem has now been resolved. We executed following statement: EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all""
|
# ? Jun 22, 2021 16:55 |
|
Why are they allowed to touch the schema?
|
# ? Jun 22, 2021 17:53 |
|
zokie posted:Why are they allowed to touch the schema? Oh they are certainly not anymore, don't worry. We're starting to hire more on-shore guys and we're brainstorming how to properly un-gently caress things like this (and that includes restricting their access to things they have shown they can't be trusted with). But until we have enough on-shore developers that we can fully cut off the offshore team, things like this are gonna pop up now and then. I even spoke to the web designer guy on our team who's often present at our meetings like this, and he's like "yeah, even I know that's a no-no."
|
# ? Jun 22, 2021 20:20 |
|
A day in the life of a professional software engineer
|
# ? Jun 22, 2021 20:35 |
|
Protocol7 posted:Oh they are certainly not anymore, don't worry. We're starting to hire more on-shore guys and we're brainstorming how to properly un-gently caress things like this (and that includes restricting their access to things they have shown they can't be trusted with). But until we have enough on-shore developers that we can fully cut off the offshore team, things like this are gonna pop up now and then. This particular type of problem is easily solved by revoking everyone's access to environments and having all changes go out through continuous delivery, with required PR approvals prior to merging to a branch that gets rolled out. If people have access to an environment, they will do dumb poo poo to that environment both by accident and on purpose.
|
# ? Jun 23, 2021 03:04 |
|
New Yorp New Yorp posted:This particular type of problem is easily solved by revoking everyone's access to environments and having all changes go out through continuous delivery, with required PR approvals prior to merging to a branch that gets rolled out. Sure, but then they complain about all the red tape for every single little change. "I only wanted to add one more row to the X table". And after a bunch of years without incidents: "Hey, nothing will happen, just let me do my thing". Now, the red tape is at least justified. The incident was needed.
|
# ? Jun 23, 2021 03:25 |
|
Someone just asked me to help with their Command Prompt batch file. They had two lines in a text file, each about 14,000 characters long that their batch file wasn't reading properly. I said there might be an escape character in there and wished him good luck.
|
# ? Jun 23, 2021 03:32 |
|
csammis posted:no longer with the company I'm assuming this is a euphemism for "was assassinated simultaneously by all of their co-workers Julius Caesar style" SirViver posted:I'd say that's a perfectly fine QuirksMode response. The HTML spec is just a suggestion anyway, right? Having done web dev for over a decade, I can confidently say that the HTML spec is, charitably, a pernicious rumor.
|
# ? Jun 23, 2021 17:57 |
|
Volguus posted:Sure, but then they complain about all the red tape for every single little change. "I only wanted to add one more row to the X table". And after a bunch of years without incidents: "Hey, nothing will happen, just let me do my thing". Now, the red tape is at least justified. The incident was needed. I think it's possible to give table permissions for add/update/delete without giving permissions for Alter Table and the like.
|
# ? Jun 23, 2021 18:30 |
|
Munkeymon posted:Having done web dev for over a decade, I can confidently say that the HTML spec is, charitably, a pernicious rumor. I found the HTML spec (a) shockingly thorough (description of a giant gross mess).
|
# ? Jun 23, 2021 18:52 |
|
|
# ? May 26, 2024 22:19 |
|
The HTML 5 spec is a thorough description of horrors. Before HTML 5 to call it a spec was stretching the truth a bit.
|
# ? Jun 23, 2021 19:30 |