/dpt/ - daily programming thread

The "RIP object oriented memes (1969-1990), it was not a pleasure knowing you, but you made me truly love Haskell, which is nice." Edition

Old:

Other urls found in this thread:

anthony.noided.media/blog/programming/c /ruby/2016/05/12/mruby-cpp-and-template-magic.html
strawpoll.me/10272941
docs.oracle.com/javase/tutorial/
isocpp.org/wiki/faq/templates#templates-defn-vs-decl
twitter.com/NSFWRedditVideo

First for fuck the kikes

kill yourself

Oh, a /dpt/ about languages nobody use. Nice.

Why do liberuls only talk about the man-woman pay gap but never about the jew-goyim pay gap?

You have been visited by the crossdressing C programmer of Shimoshina Academy!

Good performance, triple indirection, and tail call optimization will come to you, but only if you post "Keep overflowing the stack, Hime!" in this thread.

Stop making threads before we hit the bump limit you fucking attention whore.

...

Stop giving attention whores attention you stupid goyim

quit false flagging, idiot

ironic shitposting is still shitposting

Thanks for help, I wasn't aware of this, fixed it right away.

Haskellfags act all enlightened and above it all but rarely do they know lambda calculus. They're basically hipsters who got beyond Javascript.

What CS degree doesn't cover the lambda calculus?

You're assuming that most of the haskell pushers actually have CS degrees.

Pajeet's degree didn't

kek fucking jehovah's witnesses get paid 24k to go door to door?

I still can't figure out where I'm going wrong.

My driver:
#include
#include "ArrayList.h"
using namespace std;

int main()
{
ArrayList a;
}


My header:
#ifndef ARRAYLIST_H
#define ARRAYLIST_H

template
class ArrayList
{
public:
ArrayList();

bool isEmpty() const; // Checks if list is empty.
int getLength() const; // Returns the amount of times in the list.
bool insert(int index, const ItemType& item); // Inserts an item at index.
bool remove(int index); // Removes item at index.
void clear(); // Deletes every item in the list.
void whatIsAtIndex(int index); // Figure out how to throw an exception here.
int findItem(const ItemType& item); // Finds an item, then returns the index it was found.

private:
// Data members
static const int CAPACITY = 100;
ItemType list[CAPACITY]; // Array of items.
int itemCount; // Current amount of items in list.
};
#endif


cpp for just the constructor:
#include "ArrayList.h"
#include
using namespace std;

template
ArrayList::ArrayList()
{
itemCount = 0;
}


And then my error:
g++ driver.cpp
/tmp/ccsx8Q5G.o: In function `main':
driver.cpp:(.text+0x16): undefined reference to `ArrayList::ArrayList()'
collect2: error: ld returned 1 exit status

It's more that the people vulnerable to Jehovah's witnesses tend to be poor. Just like how Jews are at the top because a certain Austrian fellow got rid of the poor ones.

they do it for free

Reposting for new thread:

I wrote a blog post about some template metaprogramming shit I did in C++.

anthony.noided.media/blog/programming/c /ruby/2016/05/12/mruby-cpp-and-template-magic.html

Is it understandable? They say that the best way to learn something is to explain it. I think I definitely learned something, but I'm not sure my explanation is quite up to snuff.

So, I couldn't debug my shitty calculator in my new phone.

So, I remade a test new project with the default values the wizard produce, and it gives me this error.

default libgdx project made by wizard.

So don't blame me for it.

Definitons for templates must be in the same file.

jews also have nepotism and are unscrupulous in terms of morals

*bzzzzzzzzt*

Welfare

strawpoll.me/10272941

They got rid of the Jews because those damn Jews somehow controlled the whole economy

>strawpoll.me/10272941
you're delusional, you're not smart or superior in any way just because of the programming language you use, it's not like haskell is hard to learn, in fact you're probably stupid as shit for falling for the meme and using such a shitty shit language, even FP nerds agree that haskell is shit

Why are you so triggered Pajeet?

Good question

why are you so delusional fag?

Fucking Sup Forums go . The establishment will always blame outsiders. The US has done it with Russia and now "terrorists," the conclusive scapegoat that only exists in a limited sense for a postmodern era.

PROGRAMMING.

fuck shillary

vote trump

Is java or javascript better for beginners.

Last time I went to code academy I had a great time with javascript but couldn't finish it because my tablet broke.

Java feels odd for some reason. Or should I learn python first.

Hello stallman, my old friend. You look glorious in my terminal

java

javascript and python are easier to get started with but they're shit for actual programming

java helps you learn more serious programming

I'm not saying Jews deserve to be hated, in fact, they are probably superior to goyims. They are just better at not being worthless pieces of shit, but people have been jelly about this for a long time.

He looks like he got in a bad fight.

Don't use javascript and don't use code academy.

Java is a better choice. I guess it depends on what you want to do, but I'd recommend C though.

Start with Java, then learn haskell, Racket, and Javascript or Ruby

kill yourself

He got in a fight with 256 colors and resolution restrictions

Thanks guys. I guess I will grit my tooth and learn Java.
Is there a better site for an idiot like me?

Don't waste your time with C, only learn it if you need it for something

What the fuck is wrong with this code? From experimental observations it seems it's not.
#define update_descr_addr(descr_list, addr_field, new_addr) do { \
alt_sgdma_descriptor *cur = descr_list; \
size_t offset = 0; \
while (cur->control & ALTERA_AVALON_SGDMA_DESCRIPTOR_CONTROL_OWNED_BY_HW_MSK) { \
cur->addr_field = (void *) new_addr + offset; \
offset += cur->bytes_to_transfer; \
cur = (alt_sgdma_descriptor *) cur->next; \
} \
} while (0)

docs.oracle.com/javase/tutorial/

Hello Stallman my old friend
I've come to interject again.
Because a program softly creeping
Left its source while I was sleeping
And the vision that was planted in my brain
Still remains
Within the sound of freedom

Except C is useful everywhere.

s/not/not idempotent/

Don't learn Java.

Python is better, or C, but I recommend Python.

Everywhere that he needs it, which is hopefully nowhere. It is a terrible, weakly typed language. He should learn a modern systems language like Rust

kill yourself

no it's not, for >99% of applications there are better-suited languages

Why the fuck is that a macro? Are you literally retarded? You don't even have parens around the variable usage

What? What the hell does idempotency have to do with anything? That's a functional property.

Should I be writing macros for small inline-able functions instead of making proper functions?

...

Everybody should understand how C abstracts system memory from low level, and at least be able to read and understand C.

Then they should never actually use it for anything in because we have type and memory safe modern languages that have replaced it

Because addr_field. Thanks for parens though.

You're moron.

What does lambda calculus have to do with any specific language? It's an abstraction and it's used everywhere in compilers, interpreters, linters, etc.

Idempotence is a function property and that macro isn't a function. If one were to wrap it into a C function it would have the void type, so it really couldn't be a function.

At the very least you could write in English instead of s/not/not idempotent.

t. Rule 3

Hey /dpt/. I have no idea what to make but I really, really want to make something. Something that can be used, something mildly cool or entertaining, just something.

Any help?

If you go for the microcontrollers, you'd want to learn C. I find it relativily easy to learn since it doesn't have a whole lot of abstraction.

For PLC there is ladder, function block diagrams and sfc. (And STL and SCL.) You have to remember that PLC's were developed for industrial work and the programming reflects that. sfc is fairly easy to learn as a beginner, but ladder and function block aren't al that hard either.

Can someone give me 1 example or reason of why OOP is actually bad? Because I've never seen an actual example. And I'm not talking about ">muh Pajeets inherit everything" meme, I mean an actual reason why the tools are bad and not the people using them.

it's 'latter'

You're still moron, fucking hipster piece of shit.

I mean idempotence as in:
I'll put your neck on the ground and then I'll cut your fucking head off with a sword. And no matter how many times I'll punch the position where your neck was with the sword, your fat body and worthless head will be separated in the same state as they were after the first cut.

Only faggots try to correct usage that perfectly conveys the point.

OOP itself is not bad. It is just misused and abused very often.

It isn't in the Netherlands.

look it up fambly

it drives people to overengineer their programs which leads to them being unmaintainable. OOP is a great concept when used correctly.

>Because addr_field

Just make it a void* parameter and use a function

Make a rope and hang yourself. Only Pajeets lack creativity

>conveys the point
>s/not/not idempotent
That conveys something? That looks like nonsense to me.

I'm not pajeet, and I have ideas but they are all useless

>> inb4 arduino c isnt a programming language.
I dont care.

Im working on an arduino project, and I need to know if you can call a function from inside another function.

for example:

void loop() {
// stuff happens
functionOne();
// other stuff happens
functionTwo();
// even more stuff happens.
}

void functionOne() {
// insert stuff that happens here
functionTwo();
// more stuff happens
}

void functionTwo() {
// even more stuff happens
}

I tried looking that up: isocpp.org/wiki/faq/templates#templates-defn-vs-decl

And I'm still failing to see what I did wrong.

>impying that embedded applications encompass

Of course you can. How could you call any function other than main if you couldn't call it in main?

Dubs chooses what trivial program I write

I'm going to install lubuntu to make games and there's nothing you can do to stop it.

;)

Are you seriously learning arduino C as your first language? Of course you can you fucking retard.

Because Arduino doesn't use a main, it uses a setup() and a loop() or some shit (which main() calls, but it hides that from you)

I'm working in Javascript and making what is basically a pick-a-path adventure type thing, and I've got each section defined as an object, and the sections the player can head into from that section as an array of variables on the object.

Except now I'm running into the problem where if a section's choice isn't defined above it's just undefined, and given some of them refer back in a circular manner I can't just make sure things are defined in order.

In a simplified example, I'm basically having this issue:
var bob =
{
name: "Bob",
buddy: alice
}
var alice =
{
name:"Alice",
buddy: bob
}

function test()
{
alert(alice.buddy.name); //gives "Bob"
alert(bob.buddy.name); //gives "Unable to get property 'name' of undefined or null reference" error
}


I can probably replace the actual names with strings and then get them using those, but there isn't another more sensible way to be laying these out, is there?

So OOP itself being bad is just another Sup Forums meme then? Thanks.

>arduino c
no such thing exists

Well the same argument applies to setup and loop.

have fun

It's best to define and *declare* template classes/functions in the same file, and later include it wherever you need it.

I don't know fucking shit about javascript but is it because bob's buddy is defined as alice before alice exists

What sort of things are you going to make?

I hope you prayed to the video driver gods.

var bob =
{
name: "Bob"
}
var alice =
{
name:"Alice"
}

bob.buddy = alice;
alice.buddy = bob;


Pretty trival stuff

sent
;)

What that guy said.


And yes, I did learn arduino C as my first language. Since then I have learned "jython" which is supposedly fully compatiable with python, but it isnt. My university's intro CS class is stupid. They should have just taught us python. Jython is great for learning how programming works, but not for actually programming stuff outside of the course...

Its supposed to be python implamented in java, but it isnt exactly.

android shit, libgdx, opengl in python and c++
goo shit
SDL/SFML/Monogame

All the good package.

need now to find an open source alternative to melodyne editor

Best resources for learning C?

its supposedly just regular C but with arduino headers on it. Its not the same thing as learning C though. Cant be used to program an actual computer.

In his defense that's legitimate in lots of situations. It's legitimate in Java.
public Main {
public static void main(String[] args) {
foo();
}
private int foo() {}
}

Scheme:
(define (foo) (bar))
(define (bar) #f)
(foo)


I don't know shit about java but wouldn't it be more idiomatic to do this?
var bob, alice;
bob =
{
name: "Bob",
buddy: alice
}
alice =
{
name:"Alice",
buddy: bob
}

This is similar in form to how letrec is implemented in Scheme.

GCC, a text editor and a reference manual to the C standard library and C syntax.

it's c++

>wouldn't it be more idiomatic to do this?
Yes, that would work too, since it's reference

C Primer Plus
C Programming: A Modern Approach

That's fine for Bob and Alice, but in the 3-event demo I'm working on now I've got 24 different sections, and the proper thing'll be significantly larger, so I want to keep each section's data together as neatly as possible.

>I don't know shit about java but wouldn't it be more idiomatic to do this?

I thought of that one myself, since it'd keep things neat and I thought *should* solve the issue of things being undefined, but nope, it was (and is, tested again to confirm I didnt' just screw up last time) giving me the same error as before.

Just make Alice and Bob elements of an even larger object, and use strings