/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1533638440024.gif (400x486, 161K)

Other urls found in this thread:

gyazo.com/400543c9448a9d0a0dd862ecce953d17
twitter.com/AnonBabble

>What are you working on, Jow Forums?
Trying to find more motivation to get back to programming instead of shitposting on the 4chins all day.

Please do not use an anime image next time -- thank you.

Added support for while loops in my programming language, as well as break and continue loop control statements, then did some overall code clean up. I'm also debating if I should add labeled/multilevel loop breaks and how I'd tackle this problem.

Go? More like Go fuck yourself

Random anime images are cringe.
Anime girls with programming books are based.

Attached: mission complete.jpg (400x516, 60K)

Attached: 1545222660165.gif (640x360, 439K)

You've got the backwards. When I see images like that, I just think of the fat sweaty autist spending hours upon hours shopping dozens of those image.
Random cute anime pictures are cute, and you can find one in like 5 seconds by going to /c/.

Here you go.

Attached: 1553047862094.jpg (1200x900, 341K)

nth for Nim!

It depends what you're doing. I don't really use IDEs anymore but my default would be KDevelop since it's very easy to adapt it to different toolchains and project structures

why does the brown haired one on the right have a cigarette

any actual good C++ lecture video series out there?

No.

Attached: 1553699393283.jpg (1280x720, 451K)

You'll have to watch the series to find out why.

c++ von { bis }

What game

The one you just lost.

You lost, by the way.

more like doesn't go

>how I'd tackle this problem
I solve it by doing break/continue
if if you wanted to break out of 3 nested loops you'd do "break 3"
no idea why every language doesn't do this

That's one of the options I'm considering, the other being named loops with break[ ] to break out of a specific loop, looking it up looks like PHP supports break for break levels, though by saying "not sure how I'd tackle this problem" I meant the implementation because the way I currently do it is a bit crappy.

you can just compile it into what is essentially a goto

I thought about this just a few days ago.
I had the same idea, but I would also add a breakAll, which breaks all loops. Sure, you know how deep you are so you can use the break x command instead, but it would be more convenient and it's probably the most common usecase.

So I just recently found out I could do this:

double complex z = 2.0 + 5.0*I;

I really need to study the standard library a lot more.

Attached: 1522491137138.jpg (679x1200, 170K)

If it was a compiled language, then I guess generating a jump to a stored location would be quite trivial but I'm working on a higher level interpreted language, so I'd need to program some better loop control mechanism.

I like learning and I really want my degree but I'm considering dropping out. I'm a computer engineering major at a big 10 university with about 3.5 semesters of classes left to get my undergrad, but I have a couple of really good connections, and I have a kind of under-the-table offer for a full-time job right now at a place I really liked working for as a co-op.
I think my resume is sufficient as it is. I always find a little bit of time to work on my personal projects. My GitLab timeline thing is lit up like a fucking Christmas tree, I've missed 8 of the last 300-something days. I have glowing letters of recommendation, a little over a year of industry experience at two different firms, one being a local startup. I have made contributions to several open source projects. I mentor a high school robotics program, I've done screencasts, and I've even tutored computer science majors at my school.

Attached: 1528418398715.jpg (1000x860, 92K)

Attached: 1524229992367.png (720x720, 548K)

if you execute code with a hierarchial structure then you can have breaks/continues/returns/whatever return special escape codes which are checked for and handled further up the line, like exceptions

Just picture the fact that a couple decades ago some retard with stock options at microsoft defined max in a public header in one of the most used libraries ever

Attached: wapi.png (1354x326, 30K)

if the job offer is still available until after you graduate, then finish your schooling. If not, take the job and finish your degree down the road a bit.

Actually, now that I think of it, I already track loop depth with a context manager so it wouldn't be too hard to associate a (break, continue) pair with each loop level and check whether either flag is set for the specific loop level, then go back N steps based on the constant.

As a workaround you can just use:
(std::max)(a, b);


If you do not want to undefine that macro, but yeah I've been bit by that bullshit as well, I swear every time I have to do something MSVC related it's always issues on their end.

>As a workaround you can just use
it's a really common and really big library in a field that really doesn't like windows

quit bragging, im gonna be ur boss one day

Attached: 1545688830403.png (694x801, 77K)

Yes, it's retarded.
You can define NOMINMAX but then when you want to include gdi you run into different errors.
Of course it can all dealt with, but it's annoying, it was especially bad when I just started out with windows programming.

>in a field that really doesn't like windows
source?

>source
experience and pic related

Attached: loonix.png (980x344, 47K)

Didn't know we were talking about HPC implementations.

we big boys now

Attached: 3741283472.png (1172x675, 32K)

double dubs.

this is great, I actually know some german

dumb frogposter

you too fren

Attached: 8471234234272.gif (840x488, 252K)

dumb dumb frogposter poster

stupid frogposter

1) when, not if, programming control gets complicated, "breaking 3" could absolutely put you at the wrong control section. Or an error because you'd be out of program.

2) You know goto's exist right? Did you just try and re-invent a limited form of a feature that's existed as a single instruction, jmp, since.... many decades ago?

>1) when, not if, programming control gets complicated, "breaking 3" could absolutely put you at the wrong control section. Or an error because you'd be out of program.
yes and you could type return in the wrong place and your problem wouldn't work either
the fact that you could type the wrong thing and your program won't work isn't justification for something not existing
goto isn't a single instruction, it's an instruction and a label (which you need a name for)

yuno OP, your threads are ok but you could at least use the /dpt/ hidamari sketch OP sometimes or something other than the same 3 yuno images.

Attached: hidamari sketch.png (1618x1308, 1.95M)

You have to be retarded if you think using a botched form of goto would be somehow more convenient than goto END_OF_SHIT_LOOP or w/e

I bet you want to use it to jump up layers of bullshit n-branching meta trees or something retarded right?

Attached: whereyunobelongs.png (500x500, 110K)

>You have to be retarded if you think using a botched form of goto would be somehow more convenient than goto END_OF_SHIT_LOOP or w/e
it's:
goto end_of_loop
#end_of_loop
vs
break 3
which is shorter

redmond jihad when?

Attached: head.png (1144x221, 19K)

>not SICP on the cover

It's not only shorter, I think it results in clearer control flow.

>#define small char
>defining something to be longer than the original type

Attached: death.jpg (200x200, 7K)

#define character char

10/10 #rekt

Read a book. Programming videos are mostly awful except for the occasional talk from a conference.

conference talks are shit too

what program is this?

What's wrong with conference talks? Obviously some of them are shit, but what's wrong with them in general?

one of the recent visual studios.

In general, conference talks exist for the person giving the talk to show off and boost his own self-esteem
Educational talks usually aren't that informative to people who aren't beginners, and opinion pieces are terrible across the board especially at language conferences. These conferences are basically just social meetups disguised as something that's supposed to be educational

I meant the source code. Is that Visual Studio or is the ide Visual Studio?

Oh, the code looks like its part of the Windows 10 SDK. The IDE is Visual Studio.

I like the end questions when some pajeet who understood nothing asks retarded questions he should have known the answer to before going to the talk.

It result in a really, really shitty and wrong control flow. If someone is looking at your code, they'd have to know exactly which three controls we're in. With a goto, I can look down past the control to see what we're skipping, and ctrl-f label. You actually are an idiot to think trying to debug or refactor your shit isn't going to be a nightmare when you don't remember where "3" backs up to. And you're really going to find a seldom use case for it.

Here's a thing, WHY are you trying to put this feature in? Have you considered that your meme feature x is just as shitty as all the other langs having their meme feature x?

I agree. For example conference talks about a programming language will show Hello World level examples.
Watching them on YouTube is a waste of time, but whatever, but paying hundrets of dollars to actually attend them is really bad.

for(...){
for(...){
for(...){
...
break 2
}
print("end of loop C")
}
print("end of loop B")
}
print("end of loop A")

ok, see if you can solve this problem
where does the break jump to
only the best programmers can do this

>break 2
Good luck getting it to compile

nice trips.

does break jump all the way outside beyond the last print statement?

Considering break 2 sure don't exist, let's pretend it prints end of loop B.

no

well done

break and return exist already, and they jump to the end of an arbitrary block which may be many levels deep. break is no different in this respect, it solves the common problem of having to jump out of a nested loop more succinctly than using a goto. If you don't see why you'd need to jump out of a nested loop, you probably have never programmed anything before

>has to make a toy example to even demonstrate why jumping out of n loops with a break would better than a goto
I know you're doing multidimensional cocksucker bi-gender mapping tree-linked lists.

Attached: Come+and+try+britbong+_33d6d52a9802c4a74fe9a163c4e018d8.jpg (277x200, 11K)

>break 4
break from function
>break 5
break from program
>break 6
break from OS
>break 7
finally free

Attached: 3d-flying-objects-1.png (644x482, 5K)

I already posted why it's better than a goto here

it would only break from loops obviously, not any scope

What about break i, j, or k? It can break to where the variable was declared. It's the same amount of code but works like a label. Best of both worlds like a shemale

because you break after the loop, not to the beginning of it
there's no reason having a label is a good thing

Reminds me of a time in my Systems Programming class. The professor was explaining kill -9 and how it is the ultimate kill. Some black kid asked if there were different levels of kills, like if kill -8 is a level below -9 and - 7 a level below -8. I guess everyone thought it was a joke or something because half the class started laughing at him. He was dead serious though. It must be tough being black in computer science.

whats kill -9?

Trying to program in assembly. Is there any way for me to obtain the value stored in the Carry flag of a CCR? I tried using ADC on 0 but then realized it would add the carry bit to the value stored in the accumulator register and clearing the register beforehand would also clear the carry flag. Plz halp

it's not that dumb of a question, all -9 is doing is sending signal 9(SIGKILL) to the process. Yes you can do kill -8 and kill -7, they aren't very useful though.

kill -l

it's like kill -8 but better

Poor guy, the question was legit.

trying to fix this jank ass movement gyazo.com/400543c9448a9d0a0dd862ecce953d17

The black kid is asking the right questions to become a hacker, you retards laugh at him when you don't know shit either. pathetic.

Attached: 1547943265054.jpg (135x143, 6K)

Alright implemented the break/continue levels with the following warnings (the goto guy don't @ me).

while true do
while true do
break 0
end
end

Message:
Loop control "break" statement uses 0 levels which will be defaulted to 1.


while true do
while true do
break 1
end
end

Message:
Loop control "break" statement uses 1 level, consider removing the unnecessary level value.


while true do
while true do
break 5
end
end

Message:
Loop control statement "break" uses 5 levels in a context where only 2 levels are active.


func fn()
break
end

while true do
while true do
fn()
end
end


Message:
Loop control statement "break" found outside of a loop context.

nice
I also like that you aren't using curly braces

Fuck normies.

Last one should throw a compiler error imo.
Probably won't matter in reality though.

I'm trying to make a language personally catered to my needs which draws a lot from Python and Lua (while trying to address my gripes with both of these languages), so I'm following suit.

As I mentioned, it's an interpreted language, so I figured I'd prefer a warning than a runtime error here.

Is your language typed?

>break 2;
Ok, if break by itself is implicitly break 0, which breaks out of one level, then “end of loop A” is printed.

You mean break out a number of levels for the value held by the variable? That would make for writing entertaining code. More fun could be had with a multi-level return, especially for recursive functions. It may be the fatigue talking, but picturing the horrible abominations I could write has me giggling like a madman.

Anyway, I vote for an array-like syntax, like
Foo someFunction( int Val ) {
Foo myFoo;
// code
break[4]; // if loops were viewed as indexed from zero, innermost being zero
// more code

return[3] myFoo;
}

It’d come with all of the fun of longjmp, only it doesn’t even require you to setjmp first! The obfuscated code contests would be a hoot and a half.

But seriously, a multilevel break, especially one where you could supply a variable would be A LOT of fun to play with.

Dynamic duct typing so I guess no since I assume you're asking about strong static typing, though I may in the future toy with the idea of a typed version of my language but I don't know how far will I get with it, I'm kinda winging it for now.

>Loop control statement "break" found outside of a loop context.
What about switch statements?

>array of jumps/gotos that you can push pop from
>can jump to anything in index
>can jump to latest push and do any sort of traditional stack manipulations
Yeah no fuck you buddy

only C is retarded enough to use breaks in switch statements

I haven't implemented a switch yet but if I ever get to it, I could easily detect if I'm in a switch context and suppress this accordingly, though I'm leaning towards pattern matching that would also be used in place of a switch.

How do you make your own language? I always wondered how the languages people use to program, are programmed.

Yea, I was talking about static typing. Normally I don't like dynamic typing too much, but I am far from criticising anyone who has the skills to implement his own language. Godspeed user.