/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1546613751043.jpg (1280x720, 329K)

Other urls found in this thread:

users.rust-lang.org/t/call-for-help-implementing-an-independent-rust-frontend-for-gcc/32163/
twitter.com/NSFWRedditVideo

first for anime

Anone! Some meanies were saying that you skip your JavaScript lessons! You wouldn't skip them, right?

Attached: 6ade8a5cfbf1c2dd0de14ffe938f039f.jpg (1200x1600, 341K)

what are some good books on type theory?

I'd skip every single one of them.
fuck js fuck dynamic typing

JavaSkript anone will cut your dick off if you disrespect anone.

yes cuff my nutsack and punish my balls anone user i skip all js classes

Attached: 1567839014019.png (146x143, 24K)

Lisp is the most powerful programming language.

>write a function that only makes sense for non-empty lists
>gotta handle the empty-list case anyway
trash

k, no one cares. The colors look like shit

why does

work
but not

Attached: tuxbrainlet.png (594x720, 95K)

The declaration is used to inform a website visitor's browser that the document being rendered is an HTML document. While not actually an HTML element itself, every HTML document should being with a DOCTYPE declaration to be compliant with HTML standards.

just bake that into the types lol

yeah but why cant' i do

Attached: somethinghappened_background.png (732x533, 465K)

thank you for posting an anime pic

I like C!

i see

Okay granddad.

>
>The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.

>uses 2gb of memory to run fizzbuzz

Fleenstones?!?

>C is the only systems language.

>I like dicks in my ass

Attached: killcrab.jpg (511x788, 108K)

Okay, crabmeat

>What are C++17, Ada, Nim...

THEY'RE BULLYING ME
I WOULD NEVER DO THAT, BELIEVE ME

>I like cooperating with others to spin long sequences of greentexted sarcastic strawmen meant as facetiously attributed to the other person I'm talking to, such that it quickly becomes difficult to keep track of who's arguing what.

>sepples
>literally who
>memelang

>Cnile

>c++17
designed primarily for userspace
not portable
shit ABI
>nim
used by nobody
>ada
used only by glow in the dark boomers

>Defending your babyduck syndrome this hard.
"Used by X" is not a real argument.

How do I move from my codemonkey job to a cool job? And is such a move even desirable or will the benefits of working on something interesting be dwarfed by the loss of freedom my codemonkey job provides me? (I'm the only one on my "team" so I get a fuck load of leeway)

C++ is designed for problem spaces where strong typing is desirable. Userspace is not the only place for that.

>>ada
WTF is this shit, 370kb to print Hello, World!

ada_world $ gnatmake hello
gcc -c hello.adb
gnatbind -x hello.ali
gnatlink hello.ali
ada_world $ ./hello
Hello, World!
ada_world $ ls -lha
total 388K
drwxr-xr-x 2 rei rei 4.0K Sep 8 14:50 .
drwxr-xr-x 5 rei rei 4.0K Sep 8 14:49 ..
-rwxr-xr-x 1 rei rei 366K Sep 8 14:50 hello
-rw-r--r-- 1 rei rei 99 Sep 8 14:50 hello.adb
-rw-r--r-- 1 rei rei 1.7K Sep 8 14:50 hello.ali
-rw-r--r-- 1 rei rei 1.6K Sep 8 14:50 hello.o
ada_world $ cat hello.adb
with Ada.Text_IO;

procedure Hello is
begin
Ada.Text_IO.Put_Line("Hello, World!");
end Hello;

never used ada, but presumably it's including the runtime and shit

>systems language
>presumably includes the runtime and shit

>C doesn't have a runtime
Imagine being this fucking retarded.

evangelical Ctards are brainlets, what else is new

>new/delete
>exceptions
>RTTI
>virtual
it's clearly designed primarily for userspace
i know you can just disable exceptions for example, but they still remain a part of the grammar

>being this retarded

btw, this is not actually me.
>be me
>be baseddev
>hear about this amazing language called C
>start learning it
>realize that what you had made
>was so bloat that you cant understand it
>mfw i became a real programmer

bloat

new/delete have nothing to do in application code, it's something for library writers to implement custom pointer and allocation related logic
You can turn off exceptions and use types like std::expected
RTTI can be turned off, it's only really necessary for exceptions as well
There are ways to use virtual and have nothing virtual related in the code

do you know what ebnf is?

Define "cool job" and tell more about your background.

how do get started on programmed graphics?

What kind of graphics? In what language? What is your background?

learn math

hey Jow Forums.

retarded student taking a C++ class and I cant figure out why my program isnt outputting the values from the array correctly.

Prompt is to make a program that accepts a user defined amount of values, sorts them in ascending order, and then spits out the average of them.

Must use pointer notation for everything or else autistic prof will auto 0 you, and no c syntax whatsoever or else autist prof will auto 0 you.

I think it may be how im passing the array to the other functions maybe?

This is my code currently

Attached: dumbdumbcantC++.png (1484x837, 69K)

and this is my result. It should be outputting the array elements but instead I get this.

Attached: dumbresult.png (629x206, 7K)

First off 0 and -0 are the same int. Since size is being read from cin as an int, the stream extraction operator will coerce whatever was read to an int, so you don't have to worry about treating 0 and -0 separately as the input is no longer a string by that point, it's an int. But that shouldn't be the source of your problem.

I think where you're going wrong is that you're always storing the next test score to the same index in scores. Your 'cin >> *scores;' lines always store to the base of the scores array, no matter what your int i is.

I am working on an RPG adventure game to practice and get used to c++. So far so good but I am curious to see what other functionalities this language provides. I have studied w3schools and I have found it to be a very helpful site to learn the basics. However I see that I have much more to learn. Are there any more websites or videos that talk about a little bit more advanced stuff? Like what preinstalled libraries are mostly used and for what reason?

>using streams

Attached: 1565201968106.png (740x740, 682K)

Is it wrong that I find this arousing?

Attached: KS10-open.jpg (908x1936, 312K)

Step 1: Know what you are looking for
Step 2: Look it up on CPP reference
Step 3: Infer the meaning based on your knowledge you already have of the rest of STL

oh lord how did i miss that haha bless you user Im getting actual numbers as outputs now!

only now it will output the scores correctly but will skip the last one but I probably fucked one of the for loops, thank you user.

Out of curiosity, if you have a header in C++ with a bunch of constants that are used among various classes is that header represented at all in a class diagram?

>define cool job
Designing novel systems, working on difficult or unsolved problems, doing actual research. My current job is of the "plug libraries together until it works" type.
>background
Did a math / CS double major, of which the math part was reasonably comprehensive and the CS was a meme I didn't learn much from. Right now I write and maintain software for a manufacturing company.

fucking disgusting

If those constants are related they should be in a constant pack. Basically just a struct with the constants as static members. That struct is now a part of your class hierarchy.

Ok but you're wrong

Attached: out.jpg (4288x2848, 1.56M)

>irfanview
>snappy, can be as simple or as complex as you want it to be - virtually anything you'd want from an image viewer
>old
>made by one towelhead

>windows 10 photo viewer
>takes half a minute to load each image
>manages to not look native
>basic ass features, besides three dee balloons!! (tm)
>pic related adding a kewl sepia effect to one 600x1000, 100 KB jpeg
>the entirety of microsoft, virtual any amount of resources such a project would require, latest tech, access to deep knowledge of secret OS internals

Jihad on shit developers when?

Attached: ONE PHOTO.png (1011x72, 7K)

Ok but nope

God I hate school. Such a boring game, having to figure out what some faggot professor's sensibilities are lest he fail you

digital telephony equipment makes my pp hard because its esoteric to all but autistic phone phreaks :3

Attached: DMS-100_and_terminal.jpg (1512x2016, 690K)

>amazon sde recruitment email send me evaluation
>recommends I finish up to problem 60 on project euler before starting assessment
>asks I avoid brute force solutions and pseudocode. write a correct and optimal solution to begin with
Is this for reals?

Attached: DBCE1D2E-7EEF-4A07-BA2F-0EB3F69D1502.png (290x288, 90K)

lol good luck

Most of the first 100 problems are pretty easy, perhaps time consuming but not too troublesome.

phones are outdated garbage tech and need to go away, phone companies and the boomers paying them even more so

webpack is absolutely retarded and I hate the current web development landscape

I'm no C++ programmer and didn't read you code carefully but judging the output you're getting it looks like you have some pointer pointing to the wrong place in memory thus your cout outputs garbage

nim is shit as well. Fuck off with your obscure bloatmax languages than transpile into 5 different languages.

nim_world $ nim cc -f --threads:off --stackTrace:off --lineTrace:off --opt:size --assertions:off --checks:off -d:release hello.nim
Hint: used config file '/etc/nim.cfg' [Conf]
Hint: system [Processing]
Hint: hello [Processing]
CC: hello
CC: stdlib_system
Hint: [Link]
Hint: operation successful (11718 lines compiled; 0.742 sec total; 15.434MiB peakmem; Release Build) [SuccessX]
nim_world $ ls -la
total 60
drwxr-xr-x 3 rei rei 4096 Sep 8 16:41 .
drwxr-xr-x 7 rei rei 4096 Sep 8 16:31 ..
-rwxr-xr-x 1 rei rei 44152 Sep 8 16:41 hello
-rw-r--r-- 1 rei rei 20 Sep 8 16:30 hello.nim
drwxr-xr-x 2 rei rei 4096 Sep 8 16:41 nimcache
nim_world $ ./hello
Hello World
nim_world $ cat hello.nim
echo "Hello World"

No thanks, I'll keep my real telephone and you can enjoy your personal tracking device like a good niggercattle :-)

>15.434MiB
>"Hello World"

lmao

people need to stop making new programming languages

>amazon sde recruitment email
how do you get these emails?

Attached: 1567985465308s.jpg (124x124, 3K)

do the needful

Is this the best general-purpose programing book that humanity ever managed to produce?

I'm not even a programmer by trade, heck I'm unemployed and will probably die drunk in a ditch, but this book resonates with my soul somehow.

Attached: thepragmaticprogrammer.jpg (2200x2800, 852K)

>this book resonates with my soul somehow
Never read it. Glad you enjoyed it! I will keep an eye out for it at the book store.

lmfao this boomer

Attached: 1567617209329.jpg (720x900, 406K)

C++ looks like it will turn into Java at any point now, with each iteration they keep adding bloated shit nobody asked for. How long until it requires a VM?

It's this easy to get the functionality of C, look at how great nim is!

The following program demonstrates the ease with which extant C code can be used directly in Nim.

proc printf(formatstr: cstring) {.header: "", varargs.}

printf("%s %d\n", "foo", 5)

any one know how to solve this problem using C?
I think i need to use array right?
>A Digit Root is a feature of numbers used in mathematical recreation, but can also be used to check the results of simple operations such as sum and multiplication. One of its main properties is that the Digit Root of a number is always equal to Digit Root of the sum of its digits.

>For example, the Digit Root dofe 18446744073709551615 is the same as 87 because 1+8+4+4+6+7+4+4+0+7+3+7+0+9+5+5+1+6+1+5=87 is the same of 15 because 8+7=15, which in turn is the same as 6, since 1+5=6. Therefore the Digit Root of all these numbers is 6 since 6 is its own Digit Root.

>Your task is, given the two integers, B and E, calculate the Digit Root of BE (B raised to th E-th power).
Input

>The input consists of two lines. The first contains the number B (1 ≤ B ≤ 10105). The second contains the number E (1 ≤ E ≤ 10105).
Output

>The output consists of a single line containing the Digit Root.

codewars?

Fug I remember this from a VN I played once called 999

>any one know how to solve this problem using C?
you have to use strings to solve this problem. compute small answers, store in a string, compute again, append to it etc.

That's a fucking huge integer. You will need some sort of array. sounds like he is doing the needful

>VN
What is this?

uri
I just exercising my brain

Nevermind, I forgot you faggots are all weebs.

thank you man

kys

Not him, but I guess parsing it as a string and stoi should work for any arbitrary-sized value.

users.rust-lang.org/t/call-for-help-implementing-an-independent-rust-frontend-for-gcc/32163/

(defun digit-root (b e)
(labels ((get-digit-root (n)
(if (< n 10)
n
(get-digit-root
(reduce #'+ (mapcar #'digit-char-p (coerce (write-to-string n) 'list)))))))
(get-digit-root (expt b e))))

wut? Are you conding in LISP?

Hello world comparisons
C
gcc_world $ gcc -o hello hello.c
gcc_world $ ls -la
total 32
16,536B hello
88B hello.c
gcc_world $ cat hello.c
#include

int main(int argc, char **argv)
{
printf("Hello, World!\n");
}


C++
gpp_world $ g++ -o hello hello.cpp
gpp_world $ ./hello
Hello, World!
gpp_world $ ls -la
17,184B hello
102B hello.cpp
gpp_world $ cat hello.cpp
#include

int main(int argc, char **argv)
{
std::cout

Attached: 1567735385934.jpg (812x800, 117K)

did you mean coding? if so, yes

>caring about hello world size
you've cracked it. C is the language of choice for all your 'hello world' needs.