/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

github.com/isocpp/CppCoreGuidelines
twitter.com/SFWRedditVideos

...

Porting MultiROM for i9300 'cause I'm a poorfag.

>Created before the bump limit
>Still spamming your stupid fag meme
Delete this thread and kill yourself.

I have a mentor showing me how to build a terminal spreadsheet from scratch. Things are making a lot more sense with somebody to tell me errors instantly.

Lawyer minded fags, is GNU STL really free or only GPL'd?

If you're going to put a 2D trap at least put a good one.

Huh, seems like an interesting idea... rolling

>using a stl
Why? Stop it.

Reminder to NOT bully OOP!

Daily reminder, if you need a garbage collector it means you're writing garbage

Why do people complain about GC'd langauges where it's optional? I never get it.
There's GC'd libraries you can use for non-GC'd languages. And if you wouldn't use those why would you use the libraries in those languages that use GC?

I'm interested in teaching people things.
Anything else you've picked up? Do you think you're learning good coding practices or how to write your own software from scratch?

Like, what are you really learning. Do you get a good perspective on the craft?

>OOP

Rolling.

teach me algorithms I suck with them

...

Don't use them.
Really don't use them until you need them. Assuming you're not doing CS and just programming you rarely use that stuff.

Also how do you know you suck? I wanna know what makes you think you suck with them.

Inability to learn/understand after tons of effort to learn?

crossposting because of the new thread

>>algorithms
>don't use them


>daily programming thread

>I don't use algorithms
>Algorithms is only for CS
You're a fucking idiot. Literally your entire program is an algorithm.

I don't understand them after lots of effort and you saying you don't need them makes no sense because you have to think of algorithms for every program you write

Well I obviously assumed he was talking the typical search type stuff. Not in general.

Baiting like this is lame though. Arsehatt.

>I said something retarded
>I'll back-pedal and try to pass it off as bait
>Your face when

depends who you ask
if you ask a retard who likes OOP they will say use setters

>i can't take a joke

I've only had a few hours of coding under him so it is hard to describe. I do feel like I am learning proper coding, but we are currently working on boring things, and I don't feel like I could produce any thing we have done on my own without extensive googling.

>you have to think of algorithms for every program you write
No. Not in the sense that these guys (,) weren't talking about.
Yes, generally if you're talking about coming up with algorithms in the sense that you quite literally can't figure out what you need to do then. That's not really a programming issue honestly. You just don't know what you want to do. If you were having issues understanding what you need to do to move forward that's another thing. (generally referred to as software architecture)
See what these books talk about?
Just how new are you to programming rookie-user?
Honestly can't tell if /dpt/ is just retarded sometimes. I'm glad at least you were one person pretending to be retarded.

>Algorithms consist of sorting functions
Literally everything you do is a fucking algorithm. You have your inputs, and you try to get to some correct output. Saying you don't use algorithms is completely retarded.
You're just moving the goalposts of the word to save face.

Alright guys let's settle this once and for all.
What is objectively THE best paradigm out there?

what the piss

Is how to design programs a good book to learn from?

Procedural, while favouring pure functions.

Functional programming, assuming you have an infinitely powerful PC*

*you don't

procedural programming (this)
>the only people who can answer have read the book
>opponents of whatever it's teaching are likely to not have read the book based on how it looks
This is generally true.
I don't know, i haven't read it. I find that most who write books have grand ideas that often don't lead very far.

OOP Java

>OOP Java
Java OOP?

I wrote this and it gives weird output. Why?

template
void *charset(){
T *charset = new T(32);
for(int i = 0; i < 26; ++i){
*(charset+i) = 'A' + i;
}
return charset;
}

int main(){
int *intpnt = (int*)charset();
char *charpnt = (char*)charset();
for(int i = 0; i < 26; ++i){
printf("%i %c\n", *(intpnt+i), *(charpnt+i));
}
}

Jesus, that is one retarded mix of C and C++.
If you're going to write one of them, just write one of them, not both.

java OOP pls nerf

What?

Possibly because you're using the same name for both a pointer variable and a function?

I was experimenting, not for actual use obviously

Ok now what is this?

>mix of C and C++
It's entirely C++

Nope that didn't fix it

here's the output

...

Yes, I know it's actually C++, but a lot of his code is how you would write C.
C and C++ are completely different languages, and have evolved differently since 1980. Either fall completely for the C++ meme and lose your sanity and sense of taste, or write proper C.

There isn't a "proper" way to write C++.
You can use it how you like.
You are just mad that it's valid C++ code.

>h-haha C++ is worse than C because look at my c code:
>w-what you can do that? you're not using C++ correctly!!

>A language can be arbitrarily complex without issue because you can choose a subset.
An argument for retards.

>There isn't a "proper" way to write C++.
And that's one of the major flaws in C++. There are a million subsets of it, and two completely different people's "C++" will be completely different.

What's a good non-meme language for me to learn?

I dunno. Set a breakpoint and look at it?
Oh, you're developing in an environment without a debugger set up for you?
Too bad, you will never be a good programmer if you try to 'figure it out' without guiding yourself as well as possible.

I have a debugger set up you assuming fuck

C, C++, C#, Java, Python, scheme, lua, PHP, Javascript.

Go down the list and see what strikes your fancy.

The further down you go. Well you get the hell you deserve anyhow.

So now why were you asking us a question about something so potentially trivial?

It's after you've looked at it in the debugger and gone like "wth there's random values appearing in the registers". You come to /dpt/.

>it doesn't tell you what to do
Holy shit sorry mr gorbachev

That's not what I said
What I said was that it's silly and childish to be so mad that someone is writing "C-style" code in C++

> non-meme
Define that?

>lua near bottom of list
what's so bad about it?

Not being taught in the "GURLS PROGRAMMING" courses (an example of one of these languages would be Javascript), but still widely-used and respected
Other than C, I can't really think of anything that fits this

Not much really.
I couldn't decide wither to put it before or after scheme though.
It's just that all the others cover what it does better (imo).

Technically stroustrup is trying to fix that
github.com/isocpp/CppCoreGuidelines

The language is beyond saving.
It should have gone the way of old yeller 20 years ago.

It's such a shithole.
I'd say stay out even if they're trying to make it better.

He's a moron and he's just starting to realize it. He has caused enough harm as is.
If i could I'd put "switch to D" at the top of that. Sure, D is trying to be C++ too much. But I can't put "switch to C" there because C++ devs would just make it hard to find good programmers then.

You want something like this then.
They're all reasonable languages.
Look at the volitility in their use to see how established they are.

>They're all reasonable languages
>PHP

rax looks right when assigning as well as the memory at the printf breakpoint, and it gets normal output when debugging. When running without the debugger the output is fucked. That's why I'm asking

>Haskell one of only two languages with consistent gains
>other is shitty OOP + fake FP microspy.NET bloatbotware

C, C++, Java, C#, Python, Ruby just to name a few. There are no "meme languages", there are just languages better suited for different use-cases.

>inb4 3
Bash isn't a real programming language faggot

>but muh shell scripts

>There are no "meme languages"
There really are.
Why do you think Python became popular? Because they spammed it everywhere and it became a meme.
Same with Java.
C# was also just trying to ride on Java's memetic success.

It's Turing complete.
It's actually somewhat usable.
How is it not a programming language?

Are any of those three "meme languages" bad languages?

not the guy you're replying to, but
All fucking three of them you dumbass

here's your (you)

Yes. They all are.
Python is slow as shit, and encourages sloppy code. Practically every python program is import solution
solution.run()
Java forces OOP, the fundamentally flawed paradigm.
C# is just Java, with extra Microsoft dick.

Not sure if this is the best place to ask, I've never used regex before, but I'm trying to write a pattern, and was wondering if it's possible to use a value from the string I'm using for the pattern as a repeat value. I can't seem to find anything on this.

>stroustrop
>moron

I guess you haven't seen C++17 yet

... you can create a regex string programmatically

Are you talking about backreferences?
Because if you are, backreferences are shit, and you're trying to parse a non-regular language with regular expressions.

>Skyla
Lenora was the hottest leader from that region.

Also learn VB.net alot of jobs ask for it.

Is data and structure algorithims in Python a good meme, or should I just read clrs?

>VB.net
isn't that like, drag and drop

>C++ 17
>no concepts
>no modules
>no ranges
>no couroutines

Why not do both?
The worst part about Python is how it encourages you to import the solution

this. to make it worse the documentation for third party libs make you think you're doing actual programming when realistically it's just copypasta with arguments of your choosing. All the makers of third party libraries just call C functions anyways, making Python... absolutely skiddie friendly

Edging right now
Any cute sissy sluts wanna help me cum?

If you can't implement your own range function kill yourself

I have no problem reading both actually.

>range function
Oh, so you were just meming
You don't actually know anything about the proposals for C++17

or i should say for C++, as coroutines haven't been _formally_ proposed for C++ yet

Trying an AABB thing.

Here is an example: I need to check columns 9, 10, and 11.

But, when I run the for loop to check, it only looks at columns 9 and 10.

//pesudo code
for ( int i=9; ihitbox.y/TILE_H );
short max = ceil( (float)(ent->hitbox.y+ent->hitbox.h)/TILE_H );

but I don't want to do that, it seems far more convoluted than it needs to be.

Any ideas?

Yeah I read about those, but it didn't seem to what I wanted. I have a large set of data, and some parts are formatted like "49{49 character string}" so I was wondering if there was a regex that would read the 49 and then use that to capture the 49 characters after that.

I would use a different method but the rest of the data is formatted in a way that regex works really well.

there's a boost library for that :^)

>i

I don't know if you're still around, but that's not how you allocate an array.

OH SHIT you're right

I used parenthesis instead of square brackets. Now it works right.

Why are you returning a void*?

just fucking around with void* casts. If I were to actually use it I would just set up the function with a template in place of the void type.

There's literally no reason for void casting there, you're just getting rid of the type information and then putting it back in an unsafe fashion

rollling