/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: sicpvn.png (802x640, 783K)

Other urls found in this thread:

hackage.haskell.org/package/GotoT-transformers-1.0.0.1/docs/Control-Monad-Trans-Goto.html
blog.japaric.io/microamp/
python.org/dev/peps/pep-0020/
developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
old.reddit.com/r/rust/comments/bto10h/update_a_scaling_comparison_between_rustrayon_and/
docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=netcore-3.0
github.com/SerenityOS/serenity
twitter.com/AnonBabble

Deciding on a summer project.

Attached: kafuchiri.jpg (768x1024, 128K)

Is the C preprocessor now racist?

Attached: cpreprocessorandracism.jpg (255x217, 10K)

hopefully
I want everything to be literally hitler

sepples is nothing more than a complex c preprocessor where methods are compiled to functions with garbled names to give an illusion of having namespaces

cniles cannot comprehend abstraction of any kind, and erroneously believe their language of choice does not feature abstractions

What's a good language to learn if you're coming from C and hate every language that came after C?

Attached: cyan!.gif (540x304, 737K)

In C can I have a while else loop?
Something like this:
while()
{

}

else
{

}

Attached: 1522490943733.gif (320x287, 162K)

B

Go uses github as a package manager.. lmao wtf?

no? what would the semantics of that even be?

god help me

Attached: 1536755458072.jpg (283x438, 18K)

fortran, lisp, algol

depends what exactly the looping structure should look like
pseudocode it at the point of entry, where a condition must be checked
better if you can just sketch it up

In C I once had a while loop like this
while(condition) num += 1;

And gcc being a piece of garbage compiled it as if it was
while(condition) num;

Clang is the superior compiler.

Chinese

Fortran

no

Is "pythonic" just what Python babies call functional programming?

The else runs if the while loop exits normally by its precondition. Some languages have it, but its a pretty niche feature.

no

No Python is the anti-functional language.

i don't see why this couldn't just be a while() and then a statement immediately after it, you want it to be executed as soon as the while loop condition is no longer true, right?
that's the same as what you're asking

No, it just means really short code. Personally I think every syntax should strive for that but systems language designers have dysfunctional amygdalas and make ugly languages. See Rust, C, and sepples.

as expected he feels insecure and start name calling because he knows it is true and the language is forever doomed to live under the shadow of c while rust is superior in all possible ways

well, the romanian fascist party isn't far off

If I have a variable x that's of type __m256i, how do I get gdb to print it as v32_int8?

(gdb) p/x reg[3]
$18 = {0x32a230f432a230f4, 0x32a230f432a230f4, 0x0, 0x0}
(gdb) p/x $ymm3.v4_int64
$19 = {0x32a230f432a230f4, 0x32a230f432a230f4, 0x0, 0x0}
(gdb) p/x $ymm3.v32_int8
$20 = {0xf4, 0x30, 0xa2, 0x32, 0xf4, 0x30, 0xa2, 0x32, 0xf4, 0x30, 0xa2, 0x32, 0xf4, 0x30, 0xa2, 0x32, 0x0 }
(gdb) p/x reg[3].v32_int8
Attempt to extract a component of a value that is not a structure.
(gdb)

Why not just do this instead?

while (1) {
// code
if (breaking_condition) {
// more code
break;
}
}

The systems lang debate is a shitshow. They're all garbage. We need something new, not sepples, a C patch, nor Rust, a sepples patch.

if () {
while () {
...
}
} else {
...
}

The else block runs once only if the loop exited without a break.
You need a flag to do it without the lnaguage support I think.

what if expr side effects?

Else will never run if while ran so that doesn't match.
while () {
if(foo) {
///do stuf
break_flag = true;
break;
}
}
if(!break_flag){}

problem with these is you have to skip ahead of some code before you realize there even exists a breaking condition

maybe swapping is better:

while (1) {
if (breaking_condition) {
// more code
break;
}
// code
}

>The else block runs once only if the loop exited without a break.
break through a flag, check for that flag at the end of the loop

Should gotos be straight up banned from every language or should syslangs have it?

Wasn't that the idea?

C++

People who want "goto" to be banned should be banned

Yes, but if you put the condition check at the end and you break before that, the extra code you put in the condition check won't run.

hackage.haskell.org/package/GotoT-transformers-1.0.0.1/docs/Control-Monad-Trans-Goto.html

gotos are fine
in fact, the guy that needs his while to break can just use a goto instead and pop the return stack so it doesn't return there after it's done

F#

can't you just cast it?

How else would you exit an arbitrary nest of loops without outright returning from the function in which they lie?

Reading about asymmetric multi-processing with Rust:
blog.japaric.io/microamp/

Let go from my job due to downsizing. Considering pivoting into a frontend/dba career during the job search. Questions:
>How much SQL do I need for an entry level job?
>What are some respectable projects I could create for a portfolio?

Embedded systems class in C, I have to make some Morse code program. It’s pretty cool, only upsetting thing is these labs take 20-30 hours to complete and you only get a week for each one.

Mom! Look! I'm writing programs in Rust!

Attached: kid-on-computer-2_tnvltp.jpg (500x362, 25K)

What was your previous career?
How much SQL and DB optimization do you know?
>frontend
Plz dont

C has always been racist.
More C.
based

Attached: 1529948931815.jpg (300x400, 22K)

C odreanu

Most likely cause by undefined behaviour in your program.

No, they are useful.

oh hey, that worked

Operations.
I took an entry level dbm course in college and nearly got 100%. Pretty elaborate queries, 1st 2nd 3rd normal forms, er diagrams and schemas.
I was good at it and really genuinely enjoyed the work but haven't done anything with it since (4 years ago). I have plenty of time now.

Rust

Its a cult teaching python.org/dev/peps/pep-0020/

Anyone help me brainstorming here for a bit? I'm kinda self-teaching myself node and webdev through trial and error and I found a problem.

I'm doing http requests to retrieve json data from the Jow Forums api, then I perform calculations on this data and output these results to the console. However, if I understand node right, it does these requests asynchronously, so there is no guarantee that when I perform a calculation on the values, the values will actually exist. As a result, when running my program, sometimes I get an error like this

```
JavaScript TypeError: Cannot read property of undefined
```

which I think basically means, the value didn't exist at the time it was being used. But sometimes I don't get this error either. Which I think is basically just luck.

My question is, would it be better to not do calcuations in the http request, and instead just use these to get json and save it locally. Then read the local json file?

Attached: dedd3e21089134e0ad4bfd7c4af162de.png (671x877, 350K)

>webdev
>anime
>discord code tags
>and worst of all, javascript

Attached: 1558917560318.jpg (425x340, 14K)

Imagine writing a huge blog instead of just posting the code

how do you even know what discord code tags are?

dumb frogposter

developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

How do I access or add my API in the UWP project?
My solution looks like this:
>uwp project
>api
>dataaccess
>models
How do i access my api so that i can get data from it into my lists and stuff in the uwp project? The "right click -> add REST API client" didn't work.

So... this.. is the absolute power.. of Fearless Concurrency.. and Zero Cost Abstractions...
old.reddit.com/r/rust/comments/bto10h/update_a_scaling_comparison_between_rustrayon_and/

Attached: 0j7cvz1h2s031.png (640x480, 31K)

what the fuck are discord code tags

I don't know

how do i kill myself?

Attached: C8A1723B-6DD4-42A6-AD2A-E480150D1BD7.jpg (720x720, 50K)

docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient?view=netcore-3.0

This is completely wrong.
C++ does many things that can't be done at the preprocessing stage.

made this to learn more masm. had to download updated kernel32 lib because the ascii process32 functions were undefined.
; prints all running processes and their process ids
.386
.MODEL FLAT, STDCALL
option casemap :none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
include \masm32\include\msvcrt.inc
includelib \masm32\lib\msvcrt.lib

.data
fmt db "%s - %d", 10, 0 ; 10 is \n
.data?
.const
.code
main PROC
local lppe:PROCESSENTRY32
local hSnapshot:DWORD

invoke CreateToolhelp32Snapshot, TH32CS_SNAPPROCESS, 0
mov hSnapshot, eax

mov lppe.dwSize, SIZEOF PROCESSENTRY32
invoke Process32First, hSnapshot, addr lppe

L1:
lea ebx, lppe.szExeFile ; program name

push lppe.th32ProcessID ; pid
push ebx ; program name
push offset fmt ; format string
call crt_printf
add esp, 000ch ; 3 dwpointers

invoke Process32Next, hSnapshot, addr lppe
test eax,eax
jnz L1 ; while(Process32Next())

invoke CloseHandle, hSnapshot

invoke ExitProcess,0
main ENDP
END main

kill -9 $$

Looking around in github.com/SerenityOS/serenity

this is the most readable way of doing it, provided that expr doesn't have any side effects. It's nice since you can easily tell that the condition for the while and if are the same. With it isn't quite as obvious.
I would do it like so:
if () {
do {
...
} while ();
} else {
...
}

using a do-while removes concerns about evaluating the expression twice on the first iteration, and it's still very easy to read.

I know in C++ it could possibly be
if (x == true) {
while (true) {

}
}
else if (x == false) {

}

>71146986
>the ascii process32 functions were undefined
they were probably called A

Program in Haskell

>Rust
>No metaprogramming
>No static reflection
>No constexpr
>No metaclasses
>No coroutines
Why do people think Rust is a C++ replacement?

Because everything you listed is pointless bloat that nobody needs.
That's what's being replaced.

>That's what's being replaced.
With what? How do I achieve the same things in Rust?

>metaprogramming
>bloat

Pathetic Rust-coper

>unironically thinking metaprogramming isn't bloat

ziglang

Rust does have metaprogramming. It also has constexpr, although it's not nearly ready for use.

Why I can't I use #include directly?
Why do I have to use #include and use the compiler arg "-lstdc++fs"?
I thought filesystem was part of the standard. I'm using gcc by the way.

Still working on my UI engine. Got multi-window up and running, but it was way more work than I initially planned. Each window gets its own thread for rendering. Then, there's a master thread that handles stuff that relates to all windows.

I don't know about anyone else, but Rust gave me a fear of concurrency. Nim cured it, but it was a long recovery.

Rust has metaprogramming stuff. Probably the only thing I liked about the lang besides its enums

Update your compiler.
GCC 8 doesn't require experimental/
GCC 9 doesn't require -lstdc++fs

Half of those are unnecessary with hygienic macros. constexpr is sure lacking tho

how do i stop doing this

Attached: 1558994967.jpg (307x131, 7K)

use lisp indentation

Will java still compile like that?

Restructure your code to use early returns. Stop using "else" after continue/break/return statements.

Don't reply to bait, retard.

Did Serenity guy post today? :D

Miss him very much

I'm going to fucking kill you

Attached: 1558018243392.jpg (671x708, 117K)

there's always more c to learn. if you want something different forth and lisp are pretty great. forth and lisp are easy to implement and can be used to create DSLs to enhance your c programs user interface without libbing shit up like a web developer.

it would have entirely removed the while loop and compiled nothing if that were true. unless of course your condition had side effects, but you wouldn't have been that reckless, right?

Hi user! I'm here lurking while working on some filesystem code :)
..and helping some people who started working on Serenity.

Attached: Screenshot at 2019-05-28 00-21-48.png (1920x1080, 699K)

I got a 24 inch 1080p monitor
Should I get a secondary for dual screens? Which size and res would align best with the one I currently have?