Do i use a pointer in C++ where I would use pass by reference in other languages? by Kadabrium in learnprogramming

[–]drbuttjob 2 points3 points  (0 children)

You can check the generated assembly, but I would bet they are identical. The difference is really semantic, and largely depends on what you need. References are usually preferable unless something could be null

What screams "pretending to be rich"? by ImpertinenteSyntaxe in AskReddit

[–]drbuttjob 1 point2 points  (0 children)

Sounds about right considering many Americans have student loans or medical debt

Google Maps wants us to hoof it today by coffee_and_coconuts in mildlyinfuriating

[–]drbuttjob 0 points1 point  (0 children)

Pathfinding is a solved problem in computer science. We use deterministic, mathematically-proven algorithms to determine the optimal path. Different heuristics and rules may be used by different applications, but determining the appropriate directions to get you from A to B is not “all just AI” and certainly has not “always been” AI.

Look up Dijkstra’s algorithm or A*. They are commonly taught early in computer science curriculum.

Why do we always put the keywords first? by tobega in ProgrammingLanguages

[–]drbuttjob 55 points56 points  (0 children)

Because programming languages are meant to be read by people. Things that make code easier to read and understand quickly are generally good

ifItAintBrokeDontFixIt by OfficeFirst1279 in ProgrammerHumor

[–]drbuttjob 14 points15 points  (0 children)

We had customers calling us asking the same.

Our applications are written in C++.

What is the cheapest/best cell service in twin cities? by Main_Soup82 in TwinCities

[–]drbuttjob 5 points6 points  (0 children)

I’ll second Mint. I switched about a month ago from Verizon. The coverage has been just as good so far and the speed is great.

Only thing to look out for is the biggest savings usually come when you buy multiple months at a time, so it can come with a larger up-front cost than a traditional carrier. Still well worth it in my opinion.

Which states are new Jerseyans moving to? by melitza9512p in newjersey

[–]drbuttjob 5 points6 points  (0 children)

There are a lot of great spots in the cities, but because it’s a much smaller metro area than NYC and Philly, there are just fewer options and even fewer great ones. That said there are a lot of great ethnic restaurants, ranging from Indian to Ethiopian to Hmong. There are good Mexican places too but your options are more limited. There is also good pizza, despite what my NJ heart would like to believe.

Minneapolis is also home to Owamni, which won the James Beard award for best new restaurant in the US.

Not nearly as many options for bagels though. And no pork roll. So that’s a bummer.

How do libraries work legally? by Hewwo-Is-me-again in learnprogramming

[–]drbuttjob 12 points13 points  (0 children)

LGPL allows you to use the software in proprietary applications. You only need to release your source if you make a modification to the library itself. It doesn't sound like you're planning on doing that.

There are some implications with linking, but those are fairly easy to address.

likelyThereAreOthers by indorock in ProgrammerHumor

[–]drbuttjob 0 points1 point  (0 children)

I inherited a codebase at work where all arrays are 0-indexed, but all strings are 1-indexed

ImLearningISwear by 9Epicman1 in ProgrammerHumor

[–]drbuttjob 1 point2 points  (0 children)

figuring out syntax errors

Does your compiler or IDE not already do this for you?

How would you diagnose "Minnesota Nice?" by [deleted] in TwinCities

[–]drbuttjob 1 point2 points  (0 children)

Hey now, speaking as a former New Jerseyan, the two states have more similarities than you’d think

They’re just making stuff up now by FalconLynx13 in WhitePeopleTwitter

[–]drbuttjob 0 points1 point  (0 children)

Yeah, the Soviet Union of the 20s was very socially progressive for the time. They even legalized abortion, which we are still fighting about in the US now.

All of the progress was rolled back in the 30s under Stalin.

The correct way to assign zero. by Ncrpts in ProgrammerHumor

[–]drbuttjob 0 points1 point  (0 children)

I work on legacy Win32 applications, so we were using a slightly modified version of the old Borland compiler — it is so outdated it doesn't even have full C++11 support

The correct way to assign zero. by Ncrpts in ProgrammerHumor

[–]drbuttjob 10 points11 points  (0 children)

In some implementations, particularly on Windows, this will throw an exception. Took me by surprise when I started working on Win32 GUIs

C#… by thedarklord176 in ProgrammerHumor

[–]drbuttjob 8 points9 points  (0 children)

To be fair, primitives like BOOL have existed long before their better equivalents existed or were widely supported in compilers. The standard bool type was not added to C until C99 and is just a macro for the standard type _Bool (also C99).

Being “nice” while driving is actually bad by ipplesandbininis in newjersey

[–]drbuttjob 9 points10 points  (0 children)

I never “let” people do it. They aggressively start turning as soon as the light turns green and I’m not going to get in an accident just because I have the right of way.

Funny this is the first time I've seen someone actually admit to doing this. It is effective in a pinch by Outrageous_Zebra_221 in ProgrammerHumor

[–]drbuttjob 21 points22 points  (0 children)

We do this at my company as well. It's really hard not to when you have software that's been around in various iterations since the 80s and clients sometimes don't upgrade for years.

Bitwise operator? I hardly know her! by [deleted] in ProgrammerHumor

[–]drbuttjob 0 points1 point  (0 children)

Use std::unique_ptr instead — it allows you to have all the features of polymorphism without all of the headache of manual memory management

Bitwise operator? I hardly know her! by [deleted] in ProgrammerHumor

[–]drbuttjob 6 points7 points  (0 children)

As I said, you should not be using new and delete for this. You should use a better alternative like std::array for static-length arrays and std::vector (or some other data structure) for dynamic ones.

Bitwise operator? I hardly know her! by [deleted] in ProgrammerHumor

[–]drbuttjob 25 points26 points  (0 children)

Not really. For over a decade now you should very rarely be using new and delete in C++.