/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

sarabander.github.io/sicp/html/index.xhtml
nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/
twitter.com/AnonBabble

First for shitposting

Second for shitposting

waiting for jenkins as usual

who's jenkins?

Real thread:

the servant
he takes your source code and turns that into binaries

Defend this.

piece of shit pile of Java building, testing and deploying code

I wouldn't want to deal with the 15 different zero-like JavaScript values can be myself. This might actually be useful to a degree. Honestly it depends how well it behaves. Knowing close to nothing about JS, I suspect just (===) might not be enough to deal with things here.

Nah, all it does is:
x => Object.is(x, -0);

...what? What the actual FUCK? I need some help here, WHAT THE FUCK IS A -0?

dude floats lmao

10 as opposed to 00

What the fuck is a -0?

niggers what are you doing in /dpt/

JavaScript: Not even once.

>What are you working on, Sup Forums?
Developing an IA to play cards with me...

Reading scip
yesterday I found a page with nicer typesetting and graphics, than the mit site
sarabander.github.io/sicp/html/index.xhtml

>an IA to play cards
>IA

dunno what's it's purpose in js, but in maths
-0 an +0 are used with limits

It's the same thing in programming. The floating point standard is the way it is to allow for stuff like calculating whether something evaluates to infinity or negative infinity.

>infinity
what could possibly evaluate to infinity in programming, unless it's symbolic maths, which I doubt js is used for

Probably French. Intelligence Artificielle.

not as different numbers though
-0 just means you're approaching 0 from the left
it's exactly the same as approaching any number from the left, including positive numbers (although -+1 is obviously not the preferred notation)

Doubles do it, that's all that matters.

Wouldn't French AI just fold every time though ;^)


sorry

I hope you are all competent in Scheme.

If not, you really shouldn't be posting here.

It's mostly stuff in math.h. inverse, atan2m1, signbit_d, etc. In 98% of circumstances it doesn't matter and they'll be equivalent automatically, but when you're doing something that can use it, the functionality is there.

How come when I capture a string by reference in lambda capture list in C++ instead I get the pointer as if it was getting the address with &?

I know

I see, I never met with this in c or cpp

PROCEDURE DoIt() : LONGREAL;
VAR
tmp: LONGREAL;
BEGIN
(* begin argument reduction *)
IF t < 2.4375 THEN
(* truncate 4(t+1/16) to integer for branching *)
k := Trunc(4.0 * (t + 0.0625));
CASE k OF
| 0, 1: (* t is in [0, 7/16] *)
IF t < small THEN
tmp := big + small; (* raise inexact flag *)
IF signx > 0.0 THEN
RETURN CopySign(t, signy)
ELSE
RETURN CopySign(PI - t, signy)
END;
END;
hi := 0.0; lo := 0.0;
| 2: (* t is in [7/16, 11/16] *)
hi := athfhi; lo := athflo;
z := x + x;
t := ((y + y) - x) / (z + y);
| 3, 4: (* t is in [11/16, 19/16] *)
hi := PIo4; lo := 0.0;
t := (y - x) / (x + y);
ELSE (* t is in [19/16, 39/16] *)
hi := at1fhi; lo := at1flo;
z := y - x; y := y + y + y; t := x + x;
t := ((z + z) - x) / (t + y);
END;
ELSE
hi := PIo2; lo := 0.0;

IF t 0.0 THEN
RETURN CopySign(z, signy)
ELSE
RETURN CopySign(PI - z, signy)
END;
END DoIt;

>draw a girl
>call it a boy

It's also in C or C++. It's in the IEEE754 standard which like every modern CPU uses.

isn't it great

>attracted to a boy
>say it was drawn a girl

...

Why do so many hacks here feel the need to spam their homosexual fetish in a programming thread?
Can we start reporting them? This thread is becoming way too much like Sup Forums.

Yeah, but with limits AFAIK you only use that symbology to say "hey, the function is getting closer to 0 from the left". -0 is not a thing.

Not sure how it is in the rest of the world, but here we put the "-" on the right side if we're talking about limits in the point 0.

I've never touched JavaScript and you just gave me a good reason to keep it that way.

I really wanna french kiss Saki's butthole

>way too much like Sup Forums.
how do you know?

fml desu senpai

>looking for a way to define a generic in a generic
>wait!
>look up how to do higher kinded types in memelang
>not supported
baka haskell
now i'm spoiled with all kinds of fancy constructs i cannot use

it only segfaults when -O2 is on? ..or are you really developing without -g?

This is why you shouldn't use shit languages

That's the price I have to pay for being a wage cuck.

Can you get by without RankNTypes?
I probably can't desu

gdb ./Tetris
run

I have never found an opportunity when GDB was actually useful.
Is it exclusively for verifying state in a much larger and undocumented program not written by you?

>giving trade secrets to scrubs
Goldberg will see your account for this.

Are video codecs the state of the art in programming?

>download mp4 video x264
>500 MB

>download mp4 video x265
>131 MB
>same quality as x264

You might as well be talking Chinese, but I fixed it like so:
private fun something(player: T, settings: U, controls: Controls) {}

more like state of the art math and algorithms

delet

Shoud've used Rust, senpai.

I'm not an SJW.

In languages with runtime generics, you can treat generic functions and values as first class types.

RankNTypes allows you to quantify inside a type, rather than outside a type, allowing you to take polymorphic values as parameters, to store them in data types, etc.

*segfaults*

What would be an appropriate tattoo for a code artisan like myself?

Why does Java put the type parameters before the method name rather than between the method name and parameter list?

Yes I'm aware it's not Java, but I'm not sure what language it really is.

get the xor symbol on your shoulder

Hello World on your knuckles

jesus fucking christ absolutely disgusting

Business Card Raytracer on the back of your skull

Spotted the brainlet. Not the code's fault you're too stupid to understand it.

Is it a bad idea to just do gcc ./code.c? Never bothered to memorize the arguments you're supposed to give it

You don't need to, gcc --help

you're right it's coder's fault

gcc code.c && ./a.out

AFAIK you cannot pass around generic class types.
You have to declare the type of the generic beforehand. It's Kotlin btw.

Brainlet here. I have a C question:

Can someone tell me why, if I have a series of functions performing operations on a 2D array, that I should pass those functions a pointer to the array rather than the array itself?

Because you cannot pass an array as a parameter in C.

Yes, but is there anything wrong with doing that?

imagine ordering something from amazon and sending them a copy of your house outside their warehouse so they can drop it on your porch
Then they send the whole house back and just drop it on top of your old house, replacing it.

A pointer is like an address.
They can make changes to the house (drop a package) without making needless copies of the data.

You want it to operate on that specific 2D Array, right? If you don't send a pointer to that specific array, you're creating a new array with its values. Nothing is actually done to the array you want to be affected.

That's a no brainer now, thanks.

>go programmer quit
>now stuck maintaining a go server
ah fuck

Go isn't that bad, is it?

Thanks anons, one more question:

If I want the function to return an array (of a size I can compute with the original array), am I best supplying a "blank" array as an input or dynamically allocating memory for the output?

Apologies if this doesnt make sense, I am a Clet.

But /dpt/ users call Golang the language for dummies, if you are clever, you must quickly get a grip.

Coder did a fine job. Again, you're just too stupid to understand it.

Luckily Go has no abstraction, so he couldn't fuck up that bad.

>am I best supplying a "blank" array as an input
This is a common idiom, so do this.

Why is inc an instruction? Why not just use add 1? It would decrease design complexity.

Go is only useful for network shit.

the rest is boiler plate code for trivial tasks that could be accomplished with a couple lines in other sane language.

because incrementing by one is a very common operation

This is a humble reminder that learning how to develop your game from scratch (that is, not relaying in game engines such as unity and GMS) will take you closer to deploying a game and beat your competitors.

Because games and game development are so popular, and you are competing against other games for attention, it is in your interest to use more performant tools that allow you to program your game without cutting any feature or depending on closed software.

If you are interested in defeating your main oponents (those using game engines, like the ones listed in the op poster), here are some tips:

- Use efficient and performant programming languages, such as c++, rust or nim.
* cplusplus.com/doc/tutorial/
* doc.rust-lang.org/book/
* nim-by-example.github.io

- Learn algorithms:
* coursera.org/specializations/algorithms

- Learn maths and physics:
* khanacademy.org/math
* khanacademy.org/science/physics

- Learn how to get the most out of your cpu:
* dataorienteddesign.com/dodmain/
* learncpp.com/cpp-tutorial/79-the-stack-and-the-heap
* fgiesen.wordpress.com/2016/08/07/why-do-cpus-have-multiple-cache-levels/

- Learn how to do graphics:
* opengl-tutorial.org/beginners-tutorials/

Good luck.

still, there's no use for it and it doesn't increase performance

>idris programmer quit
>now stuck maintaining an idris server
ah fuck

>the rest is boiler plate code for trivial tasks that could be accomplished with a couple lines in other sane language.
Could you provide an example?

At this point you might think that nothing of this applies to you. Please, reconsider it:

- Data-Oriented Design (Or Why You Might Be Shooting Yourself in The Foot With OOP)
gamesfromwithin.com/data-oriented-design

- Pitfalls of Object Oriented Programming
.slideshare.net/EmanWebDev/pitfalls-of-object-oriented-programminggcap09

- common OOP game engine development pitfalls
bounceapp.com/116414

- Three Big Lies
cellperformance.beyond3d.com/articles/2008/03/three-big-lies.html

Think about it in this way: understanding how your computer work might not secure you success, yet it gives you a huge advantage in this race.

You might say that the latest famous indie game done in unity didn't put any effort into engineering at all, but this is only illusory. You cannot see how many hours, days and months the developers behind successful unity (and GMS) games had to put to work around its inherent limitations.

You can say to yourself "I don't need anything else, i'll relay in my luck" or think wisely and increase the likelihood of being success by expending some time learning more about computers.
Everything depends on you.

Depends on computer architecture.

Does the C standard actually guarantee that the string-terminating character has an integer value of 0? I know nearly everything these days uses some superset of ASCII, but could an implementation using a character set where 0 means something else (lowercase a, for example) claim to be standard conforming? Would an implementation simply perform compile-time translation of zeroes in a character context into whatever the "null character" code is on that platform? (analogous to the null pointer translation performed on platforms where 0 is a valid memory address).

go has pretty decent templating library for generating the boilerplate

String-terminating character is NUL in ASCII

excellent article already posted some threads ago

nomad.so/2015/03/why-gos-design-is-a-disservice-to-intelligent-programmers/

it's a short article you could read it in 5 minutes tops

Reminder that if you're a beginner, you should start with Java.

>cellperformance.beyond3d.com/articles/2008/03/three-big-lies.html
Broken link.

Also developing your own engine etc. adds a lot of development time, which greatly increases likely hood of never finishing game and therefore nodev

In C, I would prefer the former.

Passing an "out" pointer is better in the sense that the function doesn't have to worry about memory allocation. The function only performs the task it needs to perform and memory management is delegated to the caller.

It will however still need to make sure that the given array is big enough in order to avoid buffer overflows.

Mallocating from inside the function and returning a pointer will give the caller an easier to use API, so there's that. It's easier to type int *result = your_function(); than it is to write int *array = malloc(size); your_function(array);

But either way, don' forget to free the memory afterwards.

Right, and what if it would be a instead?