/dpt/ - Daily Programming Thread

What are you working in, Sup Forums?

Old thread:

Other urls found in this thread:

lurklurk.org/linkers/linkers.html
twitter.com/NSFWRedditVideo

First for you can't make android applications without having java layer.

just quoting my old problem for the new thread here. It has to do with how you turn a vector into a vector of vectors efficiently in C++

Also
I already will implement multithreading
Won't use UB

It's kinda sensible actual. The sheer amount of malicious code on the play store should be enough to understand that.

Can you guys give me some simple to hard gui and event handling exercises pls ??just write first thing in your mind. I need to learn this.

why gtk3 doesn't provide windows binaries

>implying security can't be accomplished without java
>installing applications you don't trust

>Won't use UB
Why? It's more efficient.

>installing applications you don't trust
Most people don't even consider trust.
>it can be done without java
Yes. But wouldn't it piss you off if you needed to use their api to do practically everything and use their data types. Using java as a wrapper is an easier solution.
It's a shame it hurts performance but for general app development it is a big plus.

I'm a huge fucking loser and can't for the life of me remember anything I learn from any programming book. I can barely even do simple stuff like reversing strings without having to google, yet still I wanted to make a videogame, I've been doing the same thing for fucking 4 years now.

Please someone shout at me because I really need this fucking shit in my head.
I need to decide on ONE fucking programming language that's not complete garbage yet still easy to learn and gives instant results.

First for Python.

>For example, on a machine on which an int is represented as a two’s complement 16-bit integer, 0xffff is the negative decimal number −1. Had more bits been used to represent an integer, it would have been the positive decimal number 65535.
This is C++ Bjarne's book.
Lets say we had more bits.
0000 0000 0000 0000(0 is singed bit) 1111 1111 1111 1111
Should not this be 65536
2^16 = 65536.
Why did he mean 65535.

You can never go wrong with C++.

What did you mean by this? You should never write UB if you want good results. There's plenty of examples where some UB will simply render your code dead code.
C is very easy to learn and the results are quick. But I suspect you're the kind of person that worries about development overhead. So go with something that has better library interfacing. Any relatively modern language really. Even java (which is quite old now).

>you needed to use their api to do practically everything and use their data types
If you do your app in java you still have to use their api to do practically anything...

Nice troll attempt there.

Hey! I wanna make a cool video game like Black Ops too!

2^16 is 65536, correct. You can represent that many values.
Naturally one of these will be 0. So your range is 0-65535.

make a console like most IDEs have

you enter text into one box underneath a box that prints messages and accepts commands.

Go C++.
Read Design patterns.
Learn to libraries.
Make more libraries.
Make them generic.
When you have enough of them.
Make a single main.cpp and use all the api you
included in libraries.
Continue with more complex libraries to include
graphics, transformation, audio, gui.
How fucking old are u?

If you do your app in java yes. But from within the NDK you're given a more familiar C environment.
Wow user that's just insidious. He just wants to learn and you're here to sow FUD.

Lisp gives instant results through the REPL.

>1111 1111 1111 1111
>Should not this be 65536
convert it to decimal and see for yourself.

>2^16 = 65536.
3 digits can represent
10^3 = 1000 different values
but the actual max value for 3 digits is 999.

My bad.
Understood.
Which book do you use for C++?

you're a pathetic fuck

I've met more than one person who wants to "make gaymes". One was a weeb who just kind of fucked off. The other was a literal cuck who majored in psychology.

The truth is if you want to mayke a gayme then you're not going to get instant results. Gayme making is like the NFL of programming

I do go wrong with C(++) very often. The one thing that constantly gets me stuck is the include/library part. I've looked thousands of miles on the internet but nobody is willing to truly explain what the hell "-lsdl2" is supposed to mean. how would the compiler even know what sdl2 is without a path? and if you include it in your search path and fucking #include it anyway, why does the whole thing matter?
These things frustrate me so.
I'm 18 and can't figure out how fucking computers work. I haven't had any advanced mathemathics either so graphics is probably out of the window already.

I'd already be happy if I got to control a 2d image sliding along a window screen.
Lisp is just too weird for me, sorry. I'm already having trouble.

I didn't learn C++ from a book. And I wouldn't say I've learned C++. (by any decent C++ programmers standard)
I'm employed as a C programmer.

The only book I've read about C++ as a language was way old. We were using borland c++, and it was oriented around that compiler, so no a particularly good book.

How much anime do you watch per day? Not even kidding, serious question here.

No worries, Lisp isn't for everyone. I was about your age when I first used it, and I thought it was pretty strange too. Do try it when you get the chance and feel up to it.

I write python mostly because that's what my org uses. Sometimes Angular. I occasionally pick up java projects for the lucene and flume applications we have. I have not had an opportunity to do C professionally but I would love to.

No

In binary you have a "ones place" at one end of your binary number (depending on endianness)

When there is a one in the ones place (called parity bit) it is an odd number.

so a power of 2 (even number) will have a zero in the ones place

> inb4 2s complement niggatry semantics

-lsdl2 tells the linker to link the code with the SDL2 library.

-l is a command line argument to the linker that should be followed by a library name.

SDL2 is a graphics library. The compiler typically searches some default paths for libraries and headers.

Yeah linking can be very confusing because the errors won't be particularly helpful ever.
lurklurk.org/linkers/linkers.html
This is a good explanation.
I think it's better you read that over having me explain it poorly.

But note that it's a very small part of programming. A requirement, but it's nothing that determines how good a programmer you are.

Haskell.

C is easy to learn?
Nope.
Tell me what type is this?
->char** (*(char* (*x)())[])(char* [])

>what the hell "-lsdl2" is supposed to mean. how would the compiler even know what sdl2 is without a path?
It doesn't.
It will search in the paths it knows about for "libsdl2.so" or "libsdl2.a" (it prepends the prefix 'lib' by convention and .so or .a suffix depending on static or dynamic linking)
>and if you include it in your search path and fucking #include it anyway, why does the whole thing matter?
If you don't add the path where the actual libsdl2 object file resides it wont find it and you'll get a linker error.
Same with include files for the compiler.

You're not gonna make a game with SDL2.

Why don't you do an experiment. Turn every pixel white then turn every pixel black 50 times while timing how long it takes. Calculate FPS

>C is easy to learn? Nope
>proceeds to write out a type that will never be seen in real code

It really isn't important what it means

Obviously it is telling the compiler "I need SDL2."

>real code
As opposed to fake code? So non-C code?

>Calculate FPS
Calculate SPF instead.
SPF is more useful, and makes more sense to everyone than FPS.

>You're not gonna make a game with SDL2.
I just did.

an error

Just because jaksgnbaejkgbhaeurhsbjvaknfbwaukfjawbjh is a word, doesn't mean anyone is going to use it.

It has no type because it's an invalid expression.

->char
It's a syntax error.
>with some leniency
Doesn't really matter because you never have such complicated types in actual programming.

0/10 troll. Doesn't even compile.
Let me guess, you're one of those buttblasted Rust fag?

it's probably shit

I don't really watch anime everyday, Maybe like one anime per two months, currently waiting for every saturday for a new episode of a certain anime to come out. Youjo Senki

This is really helpful, thank you! This is the kind of stuff I wish i'd seen written in a book, just simple english.
My brain wants to know more than just "just fucking do it you faggot" else i'd be copy pasting everything.
and you propose?

If you #include a header file for a library, you can access to the function prototypes exposed by that library. However, you typically do not get the implementation of these functions included- To make the program work you have to either provide the implementation for the functions yourself (which misses the point of libraries), or link in the library from outside. So you actually need to do both, both #include to expose your program to the functions you want to use, and link your program to the library that holds the implementations of these functions.

>Lisp for game dev

So?

what the fuck ever, it's the same thing to the power of -1 just calculate any and convert it if you really need it

So it's shit

>*(char* (*x)
Not legal you retard.

Can someone give me an in-place file sort program in Java? Need to plagiarize my way to the end of this course. Already did it with an array, but the instructor says that's wrong because he's a faggot who didn't specify in-place the first time. Fuck him.

Go for it.

It's still a game made with SDL2.

Since fps is the inverse of the actual time it doesn't intuitively scale the same way.
Increasing your fps from 20 -> 30 is a really good performance gain whereas 90 -> 100 is not so impressive.

> the retarded faggot who wants to make a game also happens to watch anime

every. fucking. time.

1. Name any situation where fps is useful to have (rather than spf)
2. Calculating spf is easier to calculate. 1 - time it took for the frame vs 1 / (1 - time it took for the frame)

(sort x '

excuse me for roaming on a website made for discussing anime.

It's not a word though, retard.

you can make a game out of laying on your upper back and trying to piss into your own mouth as well

you have no excuse

t. lost the argument

WHY are you NOT programming an AI for your 2D waifu instead of wasting your time shitposting here???(!)

>I don't really watch anime everyday,
Yes, I can tell. You need to watch more of it. It's a good way to acquire something similar to autism (which is a good thing for programming). It helped me a lot so it should probably help you too.

Fuck off back to your subreddit, your kind simply isn't welcome here.

Seriously I don't understand why would anyone watch any anime except Dragon balls.
Is episode 82 out yet?

It's not a word in english. It is a word though.

18+ please

I don't have access to the same resources that hitler's clone had.

In what language? And why are you claiming it won't be used?

Wow. So this is the average /dpt/ user
Bye guys.

get real nigga

Most weeaboos have a game idea they never make

>plebbit spacing
>spaces after '>'
>anti-anime plebbitor

>every. fucking. time.

I need a formal proof before I can believe you, I don't trust you and your ilk.

>>spaces after '>'
/polecat kebabs/

Lol. Stick to your artwork you low test disappointment

The proof is trivial

Wow, this girl has serious self-esteem issues.

Thank you, it seems to work now

>char** (*(char* (*x)())[])(char* [])

I MEANT TO GREEN TEXT

sounds like you have an IQ problem, sorry

Trash.

Two pussies fighting is a good lesbian sight.
Post pics

Still not legal.

And it turns out the whole thing was because I stupidly entered the wrong variable name in one place. God I hate things like that.

>I need to decide on ONE fucking programming language that's not complete garbage yet still easy to learn and gives instant results.
you literally want C#

Everything is possible with C#, it's easy to learn, and it's the second most popular programming language without being a shitfest that is Java.

I spend too much time trying to come up with ideas to program but I'm never successful at actually finding anything that interests me. Does/did anyone else have this problem?

I don't.
I just shitpost there.

I don't.
I just shitpost there.

lol video games are hard to make good luck with that famalamadingdong

Where can I read about embedded works in Java?

>lol
>video games
>famalamadingdong

Please do not post an anime image next time. Thanks.

I have considered your request, but I'm sorry... I have to say "No". The reason is simple. I'm from this site and this site alone.

...

...