Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
more falafel please
Feb 26, 2005

forums poster

Volguus posted:

Older crowd? 2000 was just ... twenty years ago. :corsair:

Is there anyone on SA under like 30 anymore

Adbot
ADBOT LOVES YOU

more falafel please
Feb 26, 2005

forums poster


Jeffrey of YOSPOS posted:

code:
$imageshack = array('imageshanty', 'imagetrunk', 'imagewagon', 'imagebarn', 'imagepw33n', 'imageshark', 'imagecircus', 'imagetruck', 'imagetamborine');

thanks imagepw33n!

more falafel please
Feb 26, 2005

forums poster

Plorkyeran posted:

I think the suggested limit of 50 characters for the subject line is overly short (especially when you're doing things like putting ticket numbers in the subject), but if you're going way over it then you've probably failed to actually write a subject line and should put most of that in the body.

I don't really see a reason to give a gently caress about what the line character limit for the body is. I just write some text then hit the word wrap button in my text editor.

[artbuild] [engine] [jira-420] Fix crash whe...

more falafel please
Feb 26, 2005

forums poster

a hot gujju bhabhi posted:

Why are you printing out many many pages of code?

In the late 90s/early 200s when I was in junior high/high school I printed out pages upon pages of Z80 assembly code for TI-82 games, so I could read it when I wasn't at a computer. I would write code on paper too.

more falafel please
Feb 26, 2005

forums poster


It's "could be called" right? There's multiple reasons why malloc() could return nullptr, for one thing, and func(p) may call free(p). With sz staying the same, it's entirely possible that malloc() would return the same pointer that was just freed.

more falafel please
Feb 26, 2005

forums poster

Plorkyeran posted:

Isn't invoking pointer provenance overcomplicating things there? A simplified version of that code is fairly obviously UB:

code:
void* p = malloc(sz);
free(p);
// p is now indeterminate
void* q = malloc(sz);
// reading an indeterminate value, so UB
if (p == q) {
  call(p);
}
Doing the comparison via uintptr_t is still using the value of a pointer after free, so it's still UB. Therefore the compiler can assume func() does not free p, and therefore q != p.

I guess comparing a pointer (the address itself) is use-after-free? That seems weird, but ok.

more falafel please
Feb 26, 2005

forums poster

Is casting a pointer to an integer type ever not UB? What about casting an integer type to a pointer?

I'm just saying, it might be UB by the standard, but you interact with probably hundreds of pieces of software per day that do just that, and it works just fine. Maybe that's because of compiler flags, but Literally No One except the standards committee works on a C++ project without being able to use "nonstandard" behavior. UB isn't a problem if the actual, real world behavior is defined, consistent, and understood.

more falafel please
Feb 26, 2005

forums poster

Hammerite posted:

Dealing with a legacy database where they've represented quantities that are properly regarded as sequences of integers as single integers so that when the integer is expressed in base-10 it reads like the represented quantity.

for example, a UTC offset of "four hours and thirty minutes" is represented as the integer 430, or a coordinate of "ten degrees, twenty minutes and thirty seconds" is represented as the integer 102,030.

I have no idea what to refer to this scheme as in methods I am writing to decode it (other than "stupid").

is there any way to tell if a value has a zero as its least-significant part or if it's just not expressed? like, could 430 be "0 hours, 4 minutes, 30 seconds"

more falafel please
Feb 26, 2005

forums poster

Hammerite posted:

The application I'm replacing was built by slightly less crazy people, unfortunately they weren't really giving it the attention it deserved and so there are loads of 500-line methods that perform one database query after another and then just jam all the variables together at the end (also some of the variables inform how other variables should be interpreted). And the chief guy (who is retired now) was a subject matter expert and didn't feel the need to really document half this poo poo, so occasionally to figure out what something is for I spend time following through C++ code with single-letter variable names.

I've been given free reign to rewrite this, but everything I do takes ten times as long as I think it will and I'm worried that they will get impatient and ask me why it's taking so long and the only answer I can give is "well basically everything about this is a pile of bollocks so I have to spend time figuring everything out really carefully"

Spend a little bit of your time documenting your efforts. Write up a TDD for the rewrite, write up some estimates, when you hit a snag and have to spend three days figuring out what a component does, document your progress. Then when someone says "why is this taking so long" you have something concrete to point to to show "yes, I'm doing work, it's taking longer than I thought, because this was completely hosed and I have to reverse engineer the entire thing"

more falafel please
Feb 26, 2005

forums poster

Doc Hawkins posted:

so what, you just have to sit through their Time-sharing Presentation?

:golfclap:

more falafel please
Feb 26, 2005

forums poster

zergstain posted:

Wasn't the classic Mac epoch Jan 1, 1904?

Yes, but the date on some old macs would reset to 1956 if the PRAM battery was dead. I always heard this was Steve Jobs' birthday, but apparently he was born in 1955.

more falafel please
Feb 26, 2005

forums poster


if you're using TI-BASIC as your example of why this is a good idea you've lost me

more falafel please
Feb 26, 2005

forums poster

What I don't understand is the intersection between the code that's still written using EBCDIC and the code that *needs* to be built on modern C++ compilers. I get not wanting to gently caress with 50 year old code, but why do you need to build that with a modern compiler that you can't just add a switch to?

more falafel please
Feb 26, 2005

forums poster

Falcorum posted:

And then you have the people arguing that the C++ ABI should always be stable and unbroken so they can keep using the same binary blob from 20 years ago, because the vendor has gone out of business and management doesn't want any time to be spent in finding a newer version of a small dependency for their multi million software. :v:

I'm guilty of this too, but I port video games for a living, so finding binaries of a version of Scaleform from 2009, but built for "an undisclosed platform, but it needs to be built for x64 Linux against libc++ and using clang >=x.y.z or gcc >=a.b.c" is literally hell, because you can't just replace scaleform without hiring a new UI team and adding 6 months to the project

oh and they don't have a source license for scaleform, which was sold to autodesk in 2014 or something and they no longer support it. I mean if you happen to find a source archive of that version, maybe you can tweak their cmake? It'll be illegal, but hey, who knows

more falafel please
Feb 26, 2005

forums poster

Vanadium posted:

I as a C++ pedantry enthusiast under 40 know about EBCDIC, but I can't imagine anyone knowing about it for other reasons.

I read like, a lot of fortune files in like 2000 so I hope you're ready for jokes about EBCDIC, VAXen, and PL/1

more falafel please
Feb 26, 2005

forums poster

I'm so glad I haven't made the transition into enterprise business-case poo poo writing node microservices or something because the idea of working with people who don't know how floats work is terrifying to me

more falafel please
Feb 26, 2005

forums poster

Arsenic Lupin posted:

It's funny; I learned all about shifts because they were fast. Most programmers today don't have to care about that sort of speed issue. The thing that absofuckinglutely should NOT be part of whiteboard interviews is what order sorts are. If I want a sort, I pick one from the library. If I'm doing something really esoteric with sorts, I look at the published papers and possibly talk to an actual computer scientist. And I never, ever, ever use a bubble sort, so why would I remember either its order or how to code one?

Pure virtual-dick waving.

I don't expect you to know the orders of various algorithms off the top of your head, but I do expect you to be able to reason about the orders of various algorithms, because if you can't, you're going to do some truly heinous poo poo.

more falafel please
Feb 26, 2005

forums poster

Wait knowing how floats work is theory now

more falafel please
Feb 26, 2005

forums poster

ultrafilter posted:

code:
#include <Rcpp.h>

#include <string>
#include <vector>

using namespace Rcpp;

// [[Rcpp::plugins("cpp11")]]

// [[Rcpp::export]]
List f()
{
    std::vector<int>         v1 = {1, 2, 3, 4};
    std::vector<std::string> v2 = {"a", "b", "c"};
    std::vector<double>      v3 = {5.0, 6.0, 7.8, 9, 123};
    
    return List::create(Named("name1") = v1, Named("name2") = v2, Named("name3") = v3);
}

this seems fine once i googled what rcpp was?

more falafel please
Feb 26, 2005

forums poster

Hey, it's constant time at least.

more falafel please
Feb 26, 2005

forums poster

feedmegin posted:

Even Microsoft had __fastcall

fastcall, stdcall, and thiscall all resolve to the MS convention, which does use registers.

more falafel please
Feb 26, 2005

forums poster

The closest thing I've seen to that in production code was a log print that crashed the game on PS3 on anything other than shipping config (which had all log prints disabled). We tracked it down and isolated it to a hash of an asset file being printed that contained the sequence "%n". We were, however, passing the hash through "%s" twice, once to build the string, and once to printf it with boilerplate (log level, system, etc). We were able to narrow it down to printf("%s", "%n") crashing in an empty program, only on PS3. Couldn't replicate it on any other OS/libc, and the assembly looked fine. So... we commented out the log print.

more falafel please
Feb 26, 2005

forums poster

Tei posted:

are not that touch board programable? can be programmed to produce the ESC key?

Apple, why are you doing that weird poo poo that make using a computer harder for people?

the newer touch bar macbooks have a dedicated physical esc key first

more falafel please
Feb 26, 2005

forums poster

DoomTrainPhD posted:

My high school started with basic and then moved on to C. It should still be this way.

We did Basic and then C++, but it was the APCS "C with a string class" C++

more falafel please
Feb 26, 2005

forums poster

Volte posted:

There's no reason to ever teach or use C for anything save maybe embedded programming. It's too abstract to properly teach low-level concepts and too low-level to properly teach abstractions.

What language should low-level concepts be taught in?

more falafel please
Feb 26, 2005

forums poster

I'm a weirdo in that I learned BASIC, then Z-80 assembly (to make calculator games), then "C with a string class" C++, then college where I learned a little Java, but mostly did things in C and C++. In my personal time I did most stuff in Perl 5 because I was an insufferable Unix kid in college. So when I learned about pointers I was confused for a while until I realized they were just memory addresses, just like in assembly.

I also took a PL class in college where we did some Common Lisp, some OCaml, some Haskell, and some Prolog, and eventually I wrote a micro-lisp in Smalltalk.

more falafel please
Feb 26, 2005

forums poster

Hammerite posted:

so what?

All of these are equivalent, it makes no difference which you use

code:
public static string SomeString(this MyEnum e)
{
    switch (e)
    {
        case MyEnum.X: return "A";
        default: throw new Exception();
    }
}

public static string SomeString(this MyEnum e)
{
    switch (e)
    {
        case MyEnum.X: return "A";
        default: break;
    }
    throw new Exception();
}

public static string SomeString(this MyEnum e)
{
    switch (e)
    {
        case MyEnum.X: return "A";
    }
    throw new Exception();
}
The presence or absence of a default case in the switch makes no difference, so long as the C# compiler can statically determine that every code path hits either a return statement or an uncaught exception. They all do the same thing.

I'm not a C# expert so I don't know off the top of my head if it does it by default, but in the last case, the compiler can determine that the switch doesn't handle all cases, and throw a warning/error. Not handling all cases is a cause of lots of bugs.

more falafel please
Feb 26, 2005

forums poster

What JSON parsing library is using sscanf? That seems like a terrible idea for a vaguely EBNF-style language. The whole thing smacks of hand rolled.

more falafel please
Feb 26, 2005

forums poster

meanolmrcloud posted:

I’m just a lowly dev one, but I got a crack on a new ‘rules engine’ we are developing, whose ultimate goal is to leverage the power of generics to force all future calculations thru one method, which will yank and apply rules that are expressly written for each business use case. On the one hand, it’s kinda slick, and it was fun getting it to work? On the other, what the gently caress

Every time I've worked with one of these systems it's used to do exactly one thing, badly.

more falafel please
Feb 26, 2005

forums poster

If you want to talk about programming ethics I had to work on NBA Ballers 3: Chosen One

more falafel please
Feb 26, 2005

forums poster

Sagacity posted:

Was this part of some form of mandatory community service?

Sort of? I started crunching on it immediately after crunching on John Woo Presents: Stranglehold. Afterwards they wanted me to crunch on Blitz: The League 2 and then MK vs. DC, but I switched teams and got laid off in 6 months (midway went bankrupt)

more falafel please
Feb 26, 2005

forums poster

Sagacity posted:

Was this console stuff or still Midway arcade games? How much duct tape would you say was used during the crunch, trying to get these games out the door?

Console, and tons.

more falafel please
Feb 26, 2005

forums poster

Obfuscation posted:

I've always thought that git commit messages should be like mini-branches in themselves, so you could push changes to old commit messages if a need arises

There's no way that this could cause any kind of complications, imo


Varchar(MAX) is several gigabytes in mssql, I know this because of... reasons

Perforce lets you edit changelist descriptions after they're committed. It's abusable I guess, but the only things I've ever seen it used for are: fixing typos/mistakes in the description, or having CI/build system add tags/build info.

more falafel please
Feb 26, 2005

forums poster

OddObserver posted:

They use 32-bit integers and not like 8-digit decimals or something so it can't be anything too strange?

That doesn't mean it would be easy to change. No telling how many places in that codebase just assume price is always a uint32.

more falafel please
Feb 26, 2005

forums poster

namlosh posted:

Lol, like that target article from a while ago:

“Are you sure you want to cook fish tonight? Your daughters pregnant”

I learned some networking so I could put IoT devices on a separate Vlan that had no access to anything else or the internet.

poo poo phoning home makes my skin crawl.

And I understand that others have a different tolerance than me about this privacy stuff, but the normalization of it makes it harder and harder for me to be comfortable

Yeah people don't understand that I want a television that displays its input signal, or a thermostat that switches on and off my furnace/AC based on the reading from an analog temperature probe.

more falafel please
Feb 26, 2005

forums poster

Tei posted:

I wanted to go back to C++ someday, but if It dropped the C syntax core beliefs this much maybe will be a hard pass. What a ugly re-interpretation of ( and ).

This has always been the case in C++, it is not a C++11/14/17/20 phenomenon. The name "most vexing parse" was coined by Scott Myers in Effective C++ 20 years ago: https://en.wikipedia.org/wiki/Most_vexing_parse

more falafel please
Feb 26, 2005

forums poster

C Unions are still very useful when you need a compact binary representation of data for serialization or something like that, and if you think "memory cheaper" means there aren't still tons of situations where that's something you need, you're naive.

more falafel please
Feb 26, 2005

forums poster

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.

more falafel please
Feb 26, 2005

forums poster

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.

That's not all there is to worry about though, between alignment rules and e.g. what is sizeof(long int).

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.

Adbot
ADBOT LOVES YOU

more falafel please
Feb 26, 2005

forums poster

leper khan posted:

How long until people start trying to sell me on macroservice architectures?

you joke but all these things move in cycles. thin clients vs. fat clients, monolithic vs. modular. someone's going to be selling "Schematic NoSQL" within five years, bet

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply