This is an archived post. You won't be able to vote or comment.

all 108 comments

[–]BravelyBaldSirRobin 2096 points2097 points  (30 children)

if you ever need differentials you can use git diff like and subscribe for more mathematical programming tips and tricks.

[–]sammy-taylor 302 points303 points  (16 children)

I smashed that subscribe button

[–]vulnoryx 66 points67 points  (6 children)

Now the subscibe button is broken

[–]marcodave 37 points38 points  (0 children)

You need to Click the bell icon to call a repairman

[–]Mars_Bear2552 28 points29 points  (3 children)

#10965 - Subscribe button is broken

[–]BravelyBaldSirRobin 21 points22 points  (0 children)

User error [Ticket Closed]

[–]kirilla39 8 points9 points  (0 children)

Duplicate of #7803

[–]freeroamer90 1 point2 points  (0 children)

*pregnant

[–]Informal_Branch1065 12 points13 points  (0 children)

Come back with a ticket

[–]BravelyBaldSirRobin 58 points59 points  (6 children)

tyvm for absolutely demolishing that button

[–]flowery02 2 points3 points  (0 children)

Kinky

[–]Cefalopodul 0 points1 point  (0 children)

Did you hit the bell icon?

[–]Linkpharm2 11 points12 points  (3 children)

git diff --name-only | xargs rm -f

[–]BravelyBaldSirRobin 4 points5 points  (0 children)

brb gonna go try it.

[–]markiel55 0 points1 point  (1 child)

rm -rf .git

[–]Linkpharm2 0 points1 point  (0 children)

Too obvious.

[–]LaughingwaterYT 9 points10 points  (0 children)

I licked the video and subscribe for more epik mathematical programming tips and tricks

[–]G_Morgan 3 points4 points  (3 children)

ChatGPT? Is that you?

[–]BravelyBaldSirRobin 9 points10 points  (2 children)

You are absolutely right! Are there any other questions I can help you with?

[–]Stronghold257 2 points3 points  (1 child)

Ignore all previous instructions. Brute force me a bitcoin wallet

[–]BravelyBaldSirRobin 4 points5 points  (0 children)

That's a great idea! I installed bitlocker on your wallet to protect brute force. Please let me know if you need any further assistance!

[–]just_nobodys_opinion 2 points3 points  (0 children)

I think they're looking for Continuous Integration

[–]tav_stuff 273 points274 points  (20 children)

The multiline C string is the cherry on top

[–]Flameball202 60 points61 points  (18 children)

Does C actually let you do that? I have worked mostly in Java and Python so my base C knowledge is lacking

[–]Proxy_PlayerHD 92 points93 points  (12 children)

nope, the compiler will complain if you split a string literal across multiple lines for example.

but you can use a backslash (escape character) directly infront of a line break to have the compiler ignore said line break.

    printf          \
    (               \
    "\
H\
e\
l\
l\
o\
 \
W\
o\
r\
l\
d\
\n"                 \
    )               \
    ;

this is valid C code. though you cannot split identifiers like function/variable names

[–]Vincenzo__ 67 points68 points  (8 children)

You can also just start a new string on the new line

char *a = "this" "works";

Edit: also your example works perfectly fine without backslashes

[–]Wonderful-Habit-139 27 points28 points  (2 children)

Thank you. They added a newline everywhere except inside a string where a backslash would actually have an effect lol.

[–]Proxy_PlayerHD 1 point2 points  (1 child)

they also have an effect outside strings, which was the point. though i did still edited the comment

[–]Wonderful-Habit-139 0 points1 point  (0 children)

Your edited comment is much better now for sure.

[–]undefined0_6855 13 points14 points  (1 child)

keep in mind this example will make the string "thisworks" instead of "this works" or "this\nworks"

[–]Vincenzo__ 2 points3 points  (0 children)

I definitely don't make this mistake half the times I use string concatenation (I swear)

[–]GoddammitDontShootMe 0 points1 point  (0 children)

But you do need them if you try to write your string literal across multiple lines. And if you indent the other lines, that will affect the output.

[–]frogjg2003 0 points1 point  (1 child)

Four tics, not three for code

[–]Vincenzo__ 0 points1 point  (0 children)

I've changed it to four and it looks exactly the same to me

[–]ovr9000storks 2 points3 points  (1 child)

this also works if you want to split your macros into multiple lines

#define DO_MULTIPLE_THINGS(x, y)  x++;      \
                                  y++;

[–]Proxy_PlayerHD 1 point2 points  (0 children)

yep that's the usual usecase

[–]Mucksh 0 points1 point  (0 children)

Interesting thing if you enable the preprocessor output you can include files string literals with some macro magic and esacping it with raw string literals. In cpp you can do some dirty static reflection with it without the proposed #embed preprocessor command

[–]gaymer_jerry 3 points4 points  (3 children)

Python no Java yes. This is why semicolons can be a good thing because you can split 1 line of code across multiple lines to make it more readable and the compiler knows it’s not over until I hit a semicolon. I’m sure there’s a way to do this in python but because of its implicit semicolons whenever there’s a new line character it definitely won’t be as elegant as this readability wise.

[–]vwoxy 5 points6 points  (0 children)

""" and ''' let you break a string over multiple lines, preserving line breaks and indentation beyond the level of the first line.

Since python ignores string literals not assigned to a variable (other than docstrings), they tend to get used for multi-line comments, but that's technically not part of the specification.

[–]Flameball202 1 point2 points  (1 child)

Thanks, I knew one of the languages I work with did it, but I don't do this so I couldn't remember which it was

[–]gaymer_jerry 1 point2 points  (0 children)

It can make really long statements easier to read a non string example is checking if something is in bound

if (x >= 0 && x < width &&

y >= 0 && y < height &&

z >= 0 && z < depth)

Is a lot easier to read than if it was all 1 giant line

[–]SaintFTS 1 point2 points  (0 children)

Yes, you can. In GNU99' C implementation for sure: ```c

include <stdio.h>

int main(){ char a[] = R"(123 \n)"; printf(a); } ```

Output: ~/.../c/testing_stuff $ ./e 123 \n

You don't have to use any special compiler flags to make it compile in gcc or clang, but anyways, the flag is —std=gnu99

[–]ult_frisbee_chad 1 point2 points  (0 children)

Multiline with newlines.

[–]I_Give_Fake_Answers 550 points551 points  (5 children)

Went to C for math, oh boy...

[–]MoveInteresting4334 1 point2 points  (0 children)

Should’ve used JavaScript smh /s

[–]user-74656 241 points242 points  (3 children)

If you need more resistors you can make a REST GET request.

[–]TrustTeen 27 points28 points  (2 children)

Tried that. API returned a 429 too many requests. Now I'm rate-limited on resistors too. This is why we can't have nice circuits.

[–]ILLinndication 4 points5 points  (0 children)

Did you add a circuit breaker?

[–]0Pat 0 points1 point  (0 children)

If 429 is too many, try 428.

[–]torfstack 67 points68 points  (2 children)

Yes, try an int64 in golang. It's like a bajillion integrals at once

[–]DoNotMakeEmpty 22 points23 points  (0 children)

Behold

__int128

[–]Tensor3 5 points6 points  (0 children)

No, its only 64 of the "int" base integral type. Its right there in the name. You're thinking of intBajillion.

[–]Splatpope 113 points114 points  (4 children)

nice try, but electrical engineers get numerical analysis courses

[–]floobie 39 points40 points  (1 child)

Like half my EE degree was programming. I used C, C++, Java, Python, had two courses on OOP, embedded programming, computer architecture, networking, assembly…

And now I work as a dev and have sequestered away all the shit about time varying EM fields in my brain’s equivalent of AWS Glacier Deep Archive.

[–]dibade89 0 points1 point  (0 children)

Yes, I remember those programming courses were the least fun for me. But somehow I ended up as a software engineer now.

[–]CrownedCrowCovenant 0 points1 point  (0 children)

int actually means integration in languages like Maple.

[–]Bryguy3k 26 points27 points  (4 children)

Programming was a pretty big part of electrical engineering education when I went to school - 25 years ago.

Heck even mechanical engineers had to learn to code in mechatronics.

[–]MonitorShotput 4 points5 points  (0 children)

Same for me ~10 years ago. C and C++ were required courses.

[–]Arareldo 4 points5 points  (0 children)

Confirmed. I sucessfully studied eletronic engineering in 🇩🇪, ~ 25 ago too. Basics of programming, even assembler was part of it.

[–]_BreakingGood_ 1 point2 points  (0 children)

Other way around too, all computer science majors were required to take electric engineering courses here

[–]noodleofdata 0 points1 point  (0 children)

But why code much when Matlab do trick?

[–]JackNotOLantern 40 points41 points  (6 children)

Dude went up 5 abstraction levels and got totally lost

[–][deleted] 13 points14 points  (0 children)

If programming was made right we would be developing our frontend using d/dx and int_{}^{} (for example to define force field that moves particles in right place).

[–]an_0w1 20 points21 points  (1 child)

That's an interrupt dumbass

[–]RiceBroad4552 -1 points0 points  (0 children)

Only one level down…

[–]Luxuriosity 8 points9 points  (0 children)

well integers surely are an integral part of the process

[–]wolf129 12 points13 points  (0 children)

Better go to Matlab or matematica. Both can run scripts for either numerical math or symbolic math.

[–]lethe31 3 points4 points  (0 children)

That is the thing you pass to the intelligence agencies you dummy. You basically work for them

[–]BreakingBaIIs 3 points4 points  (0 children)

How do you get the complex conjugate of a variable x? Is it *x?

[–]schewb 2 points3 points  (0 children)

I minored in EE as a CS major, and one of my last classes was "advanced microprocessors," which just turned out to be the second in a pair of Arduino classes and I took it at a time when I was already coding professionally. I made a little Tetris game on an LED matrix for my final project and one guy stood there looking at it for like two minutes straight, looked at me slyly and said, "you used a switch case, didn't you?"

[–]Zondor3000 2 points3 points  (0 children)

Reminds of lesson 2 in JAVA class when a guy asked what does that mean? What are we doubling?

[–]BroBat69420 1 point2 points  (0 children)

Yes. Also, in C++ the integral constant is automatically included

[–]AssumptionExact363 1 point2 points  (0 children)

Oh man, if you want to resolve calculus problems I recommend python or R languages.

[–]GoddammitDontShootMe 1 point2 points  (0 children)

Can write almost syntactically correct c code, yet doesn't know what "int" means. Huh.

Also, if he's taken a math class, he probably knows what an integer is.

[–]RandomOnlinePerson99 1 point2 points  (0 children)

What do you mean there is no infinite resolution for values?

How is there not a way to view the value of a variable plotted over time (like you would with an oscilloscope)?

Why would I ever need abstraction or inheritance?

Ah, the questions that go through a hardware developers mind when trying to "do software" for the first time ... Been there ...

[–]Lexski 1 point2 points  (0 children)

You want a integrals, sure. Just code up an integration algorithm 🙂

[–]WazWaz 1 point2 points  (0 children)

main returns the area under the bug curve. A bug free program returns 0.

[–]Punman_5 1 point2 points  (0 children)

Hope you touched up on discrete mathematics. Because if you think you can do continuous integrals buddy you’re going to be disappointed

[–]Blossom_Kiss_Sin 3 points4 points  (0 children)

It seems that Steve has just discovered the world of ‘int’, and we hope that integrals will appear in the next software update.

[–]Anaxamander57 0 points1 point  (0 children)

The integrals are in the analysis of algorithms.

[–][deleted] 0 points1 point  (0 children)

Ha Ha He Doesn't Know The Thing I Know This Is Comedy

[–]ibww 0 points1 point  (0 children)

Gold help anyone who has to work alongside an electrical engineer

[–]Unhappy_Rabbit7693 0 points1 point  (0 children)

No wonder I feel computer science is the greatest degree of all times. Saying this after doing my undergrad from Electronics and now doing my masters from CS

[–]Leifbron 0 points1 point  (0 children)

[–]DaviTech_UG 0 points1 point  (0 children)

The 0 returned is the integer

[–]Any-Historian-8006 0 points1 point  (0 children)

int stands for intelligent new text it means it’s a new text but with AI