[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 344
Thread images: 32

File: bernie-sanders-greed.jpg (45KB, 500x250px) Image search: [Google]
bernie-sanders-greed.jpg
45KB, 500x250px
Previous thread: >>52967786

What are you working on, /g/?
>>
0th for zero indexing is a dumb idea
>>
First for burger politics.
>>
I have a challenge for you, /dpt/.

I'm going to post some C code later on in this post. This C code will print a single number to stdout. I want you, without compiling it to find out, to tell me what number will be printed to stdout.

I can't offer any rewards, but it's a very clever challenge and I'm interested to see how fast you lads can solve it.

Here's the code. It successfully compiles using gcc and normal warning/error flags.

int magic_function(int x) {
int *px = &x;
++*px++;
*px++ += *px++ + ++*px;
return px++;
}

int main(int argc, char *argv) {
printf("Remember, no cheating!\nThe mystery number: %i\n", magic_function(13));
return 0;
}
>>
CAN'T STUMP THE TRUMP
>>
Creating a script that text to voice "Good morning beautiful" to me every morning. :)
>>
>>52975806
You sure this isn't undefined behavior?
>>
>>52975794
OP is 0th you faggot
>>
>>52975806
i doubt it's defined which number it will be
>>
>>52975806
>
++*px++;

is that even allowed
>>
>>52975806
its different each time
(i cheated)
>>
>>52975834
i actually think it is. it dereferences the initial value of the pointer, increments the pointed-to value, and increments the pointer
>>
>>52975806
>return px++;
It prints some random adress...
>>
>>52975806
>*px++ += *px++ + ++*px;
*px++ += *px++ is not valid C because it's unspecified which one of them will be evaluated first
>return px++;
Not valid C because px is a pointer and not an int

>Here's the code. It successfully compiles using gcc and normal warning/error flags.
That's a bad check, also I don't believe you considering that it's not valid C.
>>
File: leg.webm (1MB, 480x360px) Image search: [Google]
leg.webm
1MB, 480x360px
>>52975806
Is this a trick question? You just want people to compile it and then tell them they're stupid because it's undefined behavior and there is no way they got to a solution without running the code.
>>
>>52975919
>Not valid C because px is a pointer and not an int
You can do pointer arithmetic in C though.
>>
>>52975928
is there a hole in the wall with a second person providing the leg and she's an amputee?
>>
>>52975928
KNEES ARE NOT SUPPOSED TO WORK LIKE THAT.
WHAT THE SHIT
>>
>>52975931
>You can do pointer arithmetic in C though.
That doesn't mean that pointers are ints.

An int is only guaranteed to be at least 16 bits. The pointer size is architecture dependent.

Truncating types are allowed in C for value types, but are not defined for pointer types. In other words, it's valid C to truncate a double in an int but it's unspecified for a pointer.
>>
>>52975957
>>52975966
It's real senpai. I can turn my leg about 135 degrees. I can also do some tricks with my 3rd leg :DDDD
>>
>>52976014
Tripedal, please
>>
>>52976014
greater flexibility = less strength
>>
>>52976014
>I can also do some tricks with my 3rd leg :DDDD

epic
>>
>>52975863
>its different each time
Because ASLR

>>52975821
>>52975830
It is undefined

>>52975834
That's allowed, ++*px increments the pointee, while px++ increments the pointer.
>>
>>52976022
correct
>>
>>52975806
http://pastebin.com/GQPnUi7d
>>
>>52975993
I'm pretty sure there's nothing wrong with looping through an array by incrementing a pointer, but it's been a few years since I did anythin with C. Am I wrong?
>>
>>52976108
>I'm pretty sure there's nothing wrong with looping through an array by incrementing a pointer
For fuck's sake anon, you have a horrible reading comprehension and should probably kill yourself for being so stupid.

Pointer arithmetics is not the same thing as truncating a pointer type. They are not the same thing and they are not even related. So fuck off with your shitty, irrelevant answers.
>>
We're having a light, C# game programming competition at our school tomorrow;
And while there are no major prizes, I would like to come prepared so I can make the most out of it.

What should I be looking into?
>>
>>52976181
fizzbuzz
>>
>>52976181
c#
>>
a social life
>>
>>52976181
C# game programming? Unity3d?
>>
>>52976218
so he's going to install and learn unity in one day, and then make a non-trash game in like an hour or a few. right
>>
Does anyone know what the "Cooldowns" property on 4chan boards is?

"cooldowns":{"threads":600,"replies":30,"images":60,"replies_intra":60,"images_intra":60}


I have no idea what that has to do with cooldowns? trying to write descriptions of them for my library.
>>
>>52976244
how can one be this new
>>
>>52976181
C# and basic game design principles.

Likelihood is you'll know enough to maybe make a basic text adventure or tic-tac-toe at a push.

You're not going to learn or build anything of any value in a day, not sure why you'd be having a competition.
>>
>>52976244
cooldown between posting
600s between threads, 30 seconds before replies, 60 seconds before image replies etc
>>
>>52976244
>Does anyone know what the "Cooldowns" property on 4chan boards is?
After you make a post, you need to wait 30 seconds until you can make another post.


For making posts in the same thread, you need to wait 60 seconds

For threads, you need to wait 600 seconds before making a new thread.
>>
>>52976274
>>52976275
assburgers
>>
>>52976259
>LOL SO NEW XDDDD
Explain it to me then you smartass.

>>52976274
>>52976275
Not sure why I didn't see that, makes sense. Thanks lads.
>>
>>52976244
Seconds between each action, I'd wager.

You have to wait 600 seconds between thread creation, 30 seconds to post a reply on /g/ after posting one on /v/ (60 if it has an image), and 60 to post 2 replies on /g/ (and also 60 if the reply has an image).

That's just an educated guess though.
>>
>>52976284
18+
>>
>>52976284
what?
>>
>>52976287
you're a fucking joke if you couldn't figure it out jeez man

>>52976292
>>52976299
kill yourselves

it's an asperger trait to have to point out facts just because you can
>>
>>52976299
He's upset you ruined his meme (>>52976259) by actually being helpful
>>
>>52976305
fact: you're an idiot
>>
>>52976316
fact: you're on the same website as i am
>>
>>52976305
>it's an asperger trait to have to point out facts just because you can
He asked a fucking question, you fucking moron. The whole point of this thread is to ask questions and get them answered.

How autistic are you?
>>
>>52976327
but he's 18+
>>
>>52976331
lol kill yourself newfag

>>52976337
and you are not since you keep bringing it up, obviously projecting hard
>>
>>52976305
>LOL U CUDNT WERK OUT IT XDDD

I've been sat here all day writing documentation for various chan's JSON properties, it's the first time I've seen "Cooldowns" and I couldn't for the life of me think what the hell it was.

But yeah I'm such a thick fuck because I couldn't work something that had absolutely no explanation or context out.

Stop posting.
>>
>>52976347
Enjoy the banhammer.
>>
>>52976347
>look at me guis im cool because i insult people
>>
>>52976360
kill yourself idiot

>>52976356
you're literally an idiot

>>52976366
ok fag
>>
Who keeps letting these fucking children in?

>>52976347
>>52976382
>>
>>52976218
>>52976241
>>52976261

Forgot to mention that I'm fairly proficient with C# and have already created some 2D platformer games in Python before.

I just want a few tips, hacks and tricks to make it a more educational experience.
>>
>>52976392
b2reddit you massive faggot
>>
>>52976382
>>52976347
>>52976305
>>52976284
>>>/b/ is that way
>>
>>52975806 here. Honestly didn't expect to get so many replies. >>52975863 got it right, obviously. To be more specific the number printed out changes every time the program has run, and the '13' passed to the function has no effect on the result.

>>52975919
>also I don't believe you considering that it's not valid C.
See for yourself.

`px++` itself is perfectly valid - it moves the address px points to forward by one. Useful for simulating arrays.

>>52975928
>Is this a trick question?
Basically, yes. The program originally started as an exercise to see how obfuscated and standard-breaking C could get while still compiling on gcc. I realized rather quickly that while `x++ += x++ + ++x` is a compiler error through and through, it isn't if x is a referenced pointer. `++*x++` working was a nice side effect.

The "trick" is, of course, that programmers who don't know how pointers work would most likely try to follow the increment operations and figure out what the resulting variable would be, probably coming up with 51, or something close to it.
Of course that would be dead wrong, because the address is changed in the function twice, so the starting value is basically completely discarded.


I had fun writing it. Figured /dpt/ would have some fun dissecting it.
>>
>>52976392
>>52976366
>>52976337
>>52976316
>>52976292

Thanks lads for defending my admittedly stupid question, I just sat here for 10 minutes scratching my head and I couldn't for the life of me figure out what the hell it could possibly mean. I've been writing this on autopilot for a bit too long I think.
>>
>>52976422
>`px++` itself is perfectly valid - it moves the address px points to forward by one. Useful for simulating arrays.
By itself, yes

Returning it as an int however, is not.
>>
>>52976423
>admittedly stupid
hahahaha idiot and top kek at you stupid fucks answering it and defending it unironically
>>
Let's dispel once and for all with this fiction that >>52976407 is not over 18 years of age. He is EXACTLY over 18 years of age. >>52976407 is undertaking a systematic effort to contribute to this thread, to make you never fucking reply to him again.
>>
>>52976399
Wait, are you running the competition, or taking part?

From your post it seems like you're a member of staff as opposed to a student.
>>
>>52976423
we're all friends here
>>
>>52976439
It's a warning, but not an error.
>>
>>52976448
kill yourself
>>
>>52976472
isn't that what friends are for?
>>
>>52976422
>I get random results because of ASLR and undefined behaviour
>"fun"

If you want to have fun, see >>52976100

It doesn't yield random results.
>>
>>52976467
>It's a warning, but not an error.
Compiler messages mean shit, anon. You're truncating a pointer into an int. See >>52975993
>>
http://strawpoll.me/6817817

http://strawpoll.me/6817818
>>
>>52976467
>It's a warning, but not an error.

Warnings are errors.
>>
>>52976445
I'm actually taking the challenge out of curiosity, since the missions were prepared by an exterior committee anyway.

Just looking to learn some new concepts that'll make it a more fun experience, is all.
>>
>>52976521
For you.
>>
>>52976529
https://www.youtube.com/watch?v=w9wi0cPrU4U
>>
>>52976442
THERE

IT

IS
>>
>>52976587
THE MEMOIZED 25 SECOND SPEECH
>>
File: EntireSickHapuku.webm (555KB, 522x462px) Image search: [Google]
EntireSickHapuku.webm
555KB, 522x462px
For those who answered my stupid question, here's why I was being stupid.

This is about a quarter of the objects I'm writing descriptions for, just for 4chan.

I finished 8ch a little while ago.
>>
How do I use wait() and notify() without having to use synchronized in java?
>>
>>52976697
Awesome code. Great length. Look clean. Simple. Elegant. Keep us all posted on your continued progress with any progress pics or code snippets. Show us what you got man. Wanna see how freaking huge, solid, thick and tight you can get. Thanks for the motivation.
>>
>>52976697
Use F#
Then use a type provider to generate types automatically
>>
>>52976715
You again lad.

It's not even meta, I still don't understand what you're on about.
>>
>>52976511
UNSTUMPABLE

>>52976713
you don't. and before some sperg complains about this, it's the same with pthread in C/C++. with pthread you can use them but they're subject to data races so you should only do when locked on to a mutex.
>>
>>52976697
are you making a 4chan browser?
>>
>>52976746
Csharts say C# is cleaner, simpler and more elegant than java but if you look at it from an objective point of view, it really isn't.
>>
>>52976713
Short answer is, you don't.

wait() and notify() and notifyAll() are basically condition variable operations.
>>
>>52976751
>you don't
Are there alternatives I can use that function the same? I have a lock for my threads right now.
>>
>>52976742
I used Json2Csharp to provide the classes, I've just got to write all the Intellisense summaries manually.

>>52976763
I was but I got a bit bored of it, was working fine, but the limitations of the WPF framework started to hammer down on my motivation, decided to build a lib using some of my code as a baseline. I want to learn the NancyFX framework next, so I might use this lib to build a little "Chan Stats" webapp or something.
>>
>>52976794
>I have a lock for my threads right now.
Why don't you use the object mutex (the one that is implicitly locked when you use synchronized) ?
>>
>>52976794
for waking up threads that are waiting? no. you can look at the java.util.concurrent stuff which might have the high-level features you're looking for
>>
>>52976808
i haven't used nancyfx but have you considered the web api libraries provided by microsoft?
>>
>>52975775

OP pic got me hooked

if you are in the 1% you deserve to be murdered so 90% tax is going easy on you :o)

bourgeois scum
>>
>>52976868
You're gonna swing from a rope when Trump gets in office you commie scum ;)
>>
>>52976827
>>52976834
I'm entirely avoiding using synchronized, I'm trying to have a thread block itself under a certain condition until another thread notifies it.
I'll look and see what I can find
>>
i've bean working on a website
>chewzerita.com
is cool, i guess
>>
>>52976880
Trump is a socialist
>>
>>52976868
>democratic socialism
>not bourgeois
top kek
>>
File: 1442013150289.png (126KB, 308x302px) Image search: [Google]
1442013150289.png
126KB, 308x302px
>>52976868
if you're an able-bodied nigger who refuses to work you deserve to be euthanized
>>
>>52976863
Thought about it, from what I hear the NancyFX framework makes life a lot easier generally.

But I don't know the first thing about web development, Ideally I'd like to just write everything in C# and never have to ever touch anything HTML, CSS or Web related in any way ever. But I don't live on fantasy island so I'll have to do a bit of reading before I get into it either way.
>>
>>52976868
gimme dat free shit feel le bern!!!
>>
>>52976891
3 new visitors, yes!
>>
>>52976886
>I'm entirely avoiding using synchronized
why? the other option is to use Thread.sleep and volatile/atomic variables but that's disgusting
>>
>>52976893
Libergtardian please. protectionism =/= socialism
>>
>>52976886
>I'm entirely avoiding using synchronized,
But WHY anon?

>I'm trying to have a thread block itself under a certain condition until another thread notifies it.
I'll look and see what I can find
synchronized (this) {
wait();
}


otherThread.notify();
>>
>>52976868
>bourgeois scum

t. global bourgeoisie
>>
>>52976922
>>we should have public healthcare
>not a socialist
>>
>>52976886
>I'm trying to have a thread block itself under a certain condition until another thread notifies it.
This is basically a condition variable.
>>
>>52976946
>anyone who isn't a free market anarchist is a socialist
I'm so glad libertarianism is a dying ideology.
>>
>>52976868
>T-t-t-this time socialism will be different!
>>
>>52976901
gui is painful man
>>
>>52976919
>>52976935
>why
Assignment
So would I be able to make the thread sleep indefinitely, then wake it using interrupt?
>>
>>52976893
>>52976922
>>52976977
>>52976978
but, but, i thought this was a programming bread...
>>
>>52976990
?
>>
>>52976994
what do you mean "assignment"?

>So would I be able to make the thread sleep indefinitely, then wake it using interrupt?
use synchronized(lockObject) and wait/notify. what's the problem?
>>
>>52976977

It's bigger than ever. How horrifying that one day you won't be able to force other people to give you things for free.
>>
>>52977003
whether you're doing wpf ui or web based, it's painful lol
>>
>>52977011
college assignment
>>
>>52977033
the assignment doesn't allow you to use synchronized blocks?
>>
>>52977021
WPF UI is incredibly simple for me, and I haven't been using it that long honestly, maybe that's just me though.

HTML and CSS seem like a complete nightmare from the bits and pieces I've read.
>>
File: assignment.png (11KB, 1046x106px) Image search: [Google]
assignment.png
11KB, 1046x106px
>>52977054
nope
>>
File: wat.jpg (42KB, 500x333px) Image search: [Google]
wat.jpg
42KB, 500x333px
>>52977064
>>
>>52976977
>>public health care is socialist
(it literally is)
>lol u fucking liertarian free market anarchist what the fuck u
>>
>>
>>52977056
what were the WPF limitations that started to hammer on your motivation then?
>>
>>52977096
>>>reddit
>>
>>52977064
Use this then:
https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Condition.html
>>
>>52977164
This is helpful, thanks anon.
>>
>>52977096
(You)
>>
>>52977117
Inserting hyperlinks into a text display, required an ungodly amount of code to do properly using a RichTextBox, decided it wasn't worth the time or effort.
>>
>>52977199
(me)
>>
>>52977229
(Us)
>>
>>52977255
(Them)
>>
File: (me).jpg (29KB, 428x275px) Image search: [Google]
(me).jpg
29KB, 428x275px
>>52977199
>>52977229
>>52977255
>>
>>52977272
(deez nuts)
>>
>>52977164
>>52977182
the assignment is retarded. the synchronized statement is the most "low level" way of doing it and they're suggesting that you should do it even more low level, not using the high level APIs that do even more for you.
>>
>>52977255
>>52977263
(And after all, we're all just ordinary men)
>>
I'm a scrub when it comes to programming so forgive me if i sound stupid.
What kind of language does a basic computer run off of?
I've been practicing with python, and recently i got a new laptop. I got notepad++ and tried to write a simple script. but i had forgotten to install the language itself. For me, I started with python because people said it was a good introductory language, but i'd like to learn something that interacts with a computer at a very base level. I:E: a language that i dont have to install for my computer to understand.
>>
>>52977344
assembly
>>
>>52977344
batch files for windows
shell scripts for unix
>>
>>52977344
the language of 1s and 0s
>>
>>52977344
it doesn't matter what language you choose, you'll probably need to install something if it's not already installed.

those things will be the compilers/interpreters that you need to convert your code from human readable code to something that your CPU understands.

python is fine for a beginner
>>
>>52977344


>>52977371
NOT RECOMMENDED, k? good.
>>52977376
do some googling, you will find out a lot of stuff
>>52977389
idiot
>>
>>52977389
>not programming in unary.
>>
>>52977419
Python is not fine for anyone
>>
>>52977296
Rate my barrier

public class Barrier {
private int waiting = 0;
private int total;

public Barrier(int numThreads) {
total = numThreads;
}

public synchronized void synchronize() {
if (++waiting == total) {
waiting = 0;
notifyAll();
} else {
while (true) {
try {
wait();
break;
} catch (InterruptedException e) {
System.err.println(e);
}
}
}
}

public static void main(String[] args) {
final int threads = 10;
final int totalRunCount = 20;

Barrier barrier = new Barrier(threads);

for (int i = 0; i < threads; ++i) {
Runnable r = new Runnable() {
public void run() {
int runCount = 0;

while (++runCount < totalRunCount) {

try {
// fake some work
Thread.sleep(java.util.concurrent.ThreadLocalRandom.current().nextInt(1, 1000));
} catch (InterruptedException e) {
System.err.println(e);
}

synchronized (barrier) {
System.out.println("Thread " + Thread.currentThread() + " has reached level " + runCount);
}

barrier.synchronize();
}
}
};

new Thread(r).start();
}
}
}
>>
>>52977486
Looks fine to me
>>
>>52976868
Go live in North Korea, you communist swine.
>>
>>52977530
>>52977486

I can spot an error right away, I thought I accounted for spurious wakeups by doing a loop but I don't actually check if the condition is met when I wait again.
>>
>>52977553
https://www.youtube.com/watch?v=ERLaZ488I6k
>>
>>52977056
>HTML and CSS seem like a complete nightmare
How's that. Literally the easiest development code in the world.
>>
>>52975794
153'th for you're retarded.
Go back to Lua.
>>
>>52977564
Yeah and if they don't conform they, and their families, get killed.
>>
>>52977585
Lua is good
>>
>>52977604
So? There's no room for degenerates in a society.
>>
>>52977568
People call JSON easy to read (it is) but it's really a fucking mess.
>>
>>52975928
How do I do this with my legs?
For reasons.
>>
>>52975806
Well, if we got the answer, can anyone tell me what this does and a brief explanation? Looks very interesting.
>>
>>52976896
this

>>52976999
you didn't post the list of troll posts that should be ignored...
>>
>>52977683
>Well, if we got the answer, can anyone tell me what this does and a brief explanation? Looks very interesting.
It makes a demon fly out your nose.
>>
>>52977641
The conformists are the degenerates. They aren't at all contributing to society by going to events that only pander to patriotic dick stroking. Have fun with your thought police.
>>
>>52977553
>North Korea
>Communism
>>
>>52977692
D: Holy shit, really?
>>
>>52977726
Yes

https://en.wikipedia.org/wiki/Undefined_behavior
>>
>>52977683
It won't compile. magic_function returns an int * rather than an int.
>>
>>52977721
>NOT TRUE COMMUNISM
>>
>>52977721
nigga in what way is NK NOT communist?
>>
File: 1441824908749.jpg (17KB, 200x200px) Image search: [Google]
1441824908749.jpg
17KB, 200x200px
>>52975775
>that image
>amiercans in charge of understanding politics
>>
>>52977743
>I learned about politics in 4chan / stormfront!
>I know EVERYTHING about politics
>>
>>52977746
>>52977743
It is a democratic people's republic.
>>
>>52977742
Please stop spreading this meme. It will compile just fine.

>>52977683
Basically *px++ takes the value pointed at by px and adds one to it, while px++ moves the pointer itself up one address.
++*px++ is deceptive, because it actually expands to ++*px; px++.
>>
>>52977770
Communism is democratic
>>
>>52977738
My god, programming really does affect us!!!

>>52977742
The anon said it compiles, but yeah, I can see that now.
>>
>>52977759
It is a level of ignorance that baffles me
>>
>>52977746
>>52977743
>what is socialism

>>52977759
this
>>
>>52976868
>this board is this easy to be bait
when did we get invaded by /pol/
>>
>>52977743
>TRUE COMMUNISM
There is no such thing.

>>52977746
Proletariat don't rules.
>>
>>52977778
so close man

>>52977777

>>52977772
>Basically *px++ takes the value pointed at by px and adds one to it, while px++ moves the pointer itself up one address.
++*px++ is deceptive, because it actually expands to ++*px; px++.

Ah, that makes sense, thank you anon. I learned something today.
>>
>>52977164
Thank you anon, you helped me finish my assignment, now it actually works.
>>
>>52977779
Seriously, plug that source code into gcc and gcc will give you back a functional binary.
>>
How can I calculate the average of 2 ints?
>>
>>52977772
>Please stop spreading this meme. It will compile just fine.
It really doesn't. Pic related.

>Basically *px++ takes the value pointed at by px and adds one to it, while px++ moves the pointer itself up one address.
++*px++ is deceptive, because it actually expands to ++*px; px++.
The problem is, if you haven't noticed yet, this line

    *px++ += *px++ + ++*px;


It is unspecified behaviour, because any of the "*px++" may be executed in any order.
>>
Is a map/dictionary more generic than a tree?
>>
>>52977848
fuck off
>>
File: fsharp code quotation.png (3KB, 278x41px) Image search: [Google]
fsharp code quotation.png
3KB, 278x41px
>>52977848
Use code quotations
>>
>>52977857
>clang
>>>>>>>>>>>>>>>>clang
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"""""""""""""""""""""""""""""""""""""""""""CLANG""""""""""""""""""""""""""""""""""""""""""
>>
I don't know why i did it, but yup...
>>
>>52977893
clang is better than memecc
>>
>>52977883
>functional meme
>>
>>52977916
What's wrong with this?
>>
>>52977893
Nice “faggot” quotes
>>
>>52977848
google it, you faggot
https://stackoverflow.com/a/5700904
>>
>>52977935
Overflow.
>>
>>52977935
Functional programming is garbage. There's no valid use case to use functional programming instead of imperative programming.
>>
>>52977916
>meme meme
>>
Why is this wrong?

int x ;
cout << ( cin >> x );
>>
>>52977961
Prove it.
>>
>>52977846
Yep, looks like it works.

Thanks, anon!
>>
>>52977966
I meant what's wrong with what I gave

>>52977972
cin >> x;
returns cin
so that when you
cin >> x >> y;
that's
(cin >> x) >> y;
which is
cin >> x; cin >> y;
>>
>>52977883
very disgusting
>>
File: 1455416673422.jpg (168KB, 1920x1080px) Image search: [Google]
1455416673422.jpg
168KB, 1920x1080px
I want /pol/ to leave
>>
>>52978002
Nothing. It's just that functional programming is a joke.
>>
>>52977164
>https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Condition.html
a condition is a monitor
>>
>>52977972
cin returns cin, so you're basically doing:
int x;
cin >> x;
cout << cin;
>>
>>52978013
F# is multi paradigm and allows imperative code
>>
>>52977846
>Seriously, plug that source code into gcc and gcc will give you back a functional binary.
It gives me a segmentation fault.

>>52978030
Every Java object is a monitor.
>>
>>52978041
They should add an output type so that you can use (cout >> out<T>) in an expression
>>
>>52978011
>>>/a/
>>
>>52978047
F# pretty much only dips its toe into the pool of being functional. That's it.
>>
File: anime on 4chan.jpg (202KB, 897x445px) Image search: [Google]
anime on 4chan.jpg
202KB, 897x445px
>>52978073
>>
>>52978171
>this looks shooped
>>
>>52978171
fug off back 2 reddit is filtered now
>>
>>52977746
In what way is it?

>classless
There are clearly classes
>moneyless
Money is being used.
>stateless
top kek

It calls itself democratic. I don't even know if it calls itself Communist, but if it did, would you believe it?
>>
>>52978171
>i have no identity so i latch on to shitty cartoons and put them with everything i post
i dont even mind anime but why do weebs have to have an anime image with EVERYTHING
>>
File: 1454635733352.jpg (207KB, 600x600px) Image search: [Google]
1454635733352.jpg
207KB, 600x600px
#!/bin/sh
echo 'I love you, anon'
>>
File: c9e.gif (3MB, 500x500px) Image search: [Google]
c9e.gif
3MB, 500x500px
>>52978230
>come on 4chan
>complain about anime posting
normie logic
>>
>>52977746

Its more like a Communist inspired Monarchy
>>
What's the best platform to build an RPG 2D side-scroller with?
>>
>>52978013
>functional programming is a joke
Couldn't figure it out, huh?
>>
>>52978293
Nike Boosts
>>
>>52977437

> not programming in base e
>>
>>52978470
>falling for the e meme
>>
int ada = 3;
auto bee = & ada ; // what is the type of bee?
auto com = * bee ; // what is the type of com?
int doors [5];
auto emc2 = doors + 2; // what is the type of emc2 ?
help?
>>
>>52978515
They all have type auto.
>>
>>52978515
bee is do your homework on your own
>>
>>52978515

auto
>>
>>52978515
Do your own homework maybe?
This looks like first assignment stuff so if you don't learn this you'll be screwed for the rest of the course.
>>
>>52978553
>>52978586
>>52978607
>>52978608
dont be a jackass guys

>>52978515
bee is int&
com is int*&
emc is int[3]
>>
>>52978515
lol just ask the compiler

http://stackoverflow.com/questions/81870/is-it-possible-to-print-a-variables-type-in-standard-c
>>
>>52978631
Fuck off. This isn't /homework/
>>
File: 1326254202304.jpg (3KB, 117x126px) Image search: [Google]
1326254202304.jpg
3KB, 117x126px
>>52976770
>implying summary tags are required
>implying Java code can't be written exactly the same way, or worse
>implying getters/setters are better than properties
>judging an entire language based on a webm of 1 code snippet
>implying something subjective is objective
>being this salty about learning Java instead of C#

okay
>>
bee is pointer of int so int*
com is derefrenced int pointer so int
doors is a int pointer so emc2 is int*
>>
>>52978631
>emc is int[3]
>>
>>52978654
Java and C# are basically the same language.
>>
>>52978515
bee is int*
com is int**
emc2 is *int
>>
>>52978654

What I don't get is that knowledge transfers between C# and Java so easily, yet this guy is on a "cshart" crusade.
>>
For any C# devs who are interested in doing work with 4chan, I just released a relatively stable version of my library that is actually now worth using and I've given it a writeup to make getting into it a bit easier.

https://github.com/sirdoombox/VichanSharp

It's on Nuget as well if anyone wants to give it a try, I'd love to get some bug reports and maybe a bit of feedback

Install-Package VichanSharp

(At least I'm posting about something I'm working on right?)
>>
>>52978719
what does it do?
also ebin @ using nuget in the year of the lord two thousand and sixteen
>>
File: jack_reed.jpg (279KB, 750x500px) Image search: [Google]
jack_reed.jpg
279KB, 750x500px
>object oriented language
>class doesn't inherit from object
>>
>>52978761
c++ object is void
>>
>>52978751
It handles the entirety of the API stuff for you, it gets the JSON, stores it in usable objects and from there you can do whatever the hell you like, build a webapp with statistics, make a browser, whatever I don't care.

What's wrong with Nuget?
I want to use a library in my project
>Install-Package SomeLib
I am now able to use a library in my project.
>>
>>52978751
>>52978793
Oh and it works with 8ch as well at the moment, in the future I'll add even more Chans.
>>
>>52978793
Sounds cool, I'll check it out later.
What's it written in?
>>
>>52978654
>talking down on people
>wihle posting a thumbnail
>>
>>52975775
stop uploading unrelated shit
>>
>>52978813
>For any C# devs
>VichanSHARP

You tell me :^)
>>
>>52978846
Had to check, wouldn't be the first time I had C# code cucked by VB.NET libraries.
>>
>>52978719
I'll check this out later tonight anon
>>
>>52978871
>>52978947
Recommend you both take a quick look at the Readme on github, mainly so you know about the extension methods for cleaning up comments and the "time" data.
>>
File: 1455486877285.png (1MB, 1920x1080px) Image search: [Google]
1455486877285.png
1MB, 1920x1080px
>>52978836
>2.12 MB
>>
>>52979035
>caring about filesize
>>
File: 1455486877285.jpg (150KB, 1920x1080px) Image search: [Google]
1455486877285.jpg
150KB, 1920x1080px
>>52979035
>1.3 MB
>>
>>52979035
>>52979061

http://i.4cdn.org/g/1455487464744.jpg
37B
>>
File: 1455431866808.jpg (190KB, 477x530px) Image search: [Google]
1455431866808.jpg
190KB, 477x530px
>>52979061
>>52979086
>jpg
>>
>>52979101
>png
>>
>>52979101
http://i.4cdn.org/g/1455486877285.png
37B
>>
>>52979101
>anime
>>
>>52977862
What do you mean? Like how linked lists are a subset of trees? Then no, they're not related. Graphs are generalized trees.
>>
01101010

1B
>>
File: 1455320564563.jpg (85KB, 701x480px) Image search: [Google]
1455320564563.jpg
85KB, 701x480px
>>52976886
You want to create a Monitor-class, with a lock and a conditionalVariable for that lock.
>>
>>52979183
tree:
dict["a"] = ...
dict["a.b"] = ...
dict["a.b.c"] = ...
dict["a.d"] = ...

graph:
dict["a"].first = node
dict["a"].second["->b"] = ...
>>
Making a game engine with a friend. It's probably going to fail, but it'll still be fun.
>>
>>52979266
no it won't
>>
>>52979279

I'm a big enough of a masochist that it'll be fun.
>>
>>52979319
no it won't
>>
>>52978719
why not leave images as byte arrays instead of creating a dependency on WPF and therefore windows
>>
>>52979241
You're just storing the nodes in the dictionary (and gaining nothing for it). Remove the dictionary (or replace it with an array) and it would still work.
>>
>>52979369
he's part of the botnet
>>
>>52979372
dict["a"] = { ("b", 5); ("c", 3) }

dict<string, dict<string, size_t>>
>>
>>52979369
Could do, add the conversion into the extension methods.

Thanks for the feedback, didn't really think about that.
>>
https://aur.archlinux.org/packages/gtk2-patched-filechooser-icon-view/
https://aur.archlinux.org/packages/firefox-gtk2/
>>
>>52979468
fug, I posted in the wrong thread
>>52979368
>>
>>52975775
>>
>>52979501
>>
>>52979421
Yes, and? You're still just storing the nodes in dicts.
>>
>>52979501
Lowest tax bracket
Bernie: 10% -> 12% Tax
Trump: 10% -> 0% Tax
>>
>>52979529
and the edges, and providing a data structure organising this
>>
>>52979542
This. Bernie supporters don't actually care about poor people, only free college and marijuanas.
>>
>>52979527
>>
>>52979542
>falling for the "low tax = good" meme
>>
>>52979645
>stealing money from the rich AND the poor to give to the state

bernie 2016
>>
>>52979542
lets see, who makes more money

minimum wage of less than $8/hr paying 0% tax
or
minimum wage of $10-$15/hr paying 10% tax
>>
>>52979645
Everyone wants to live in a developed society but no one wants to pay for it.

Race to the bottom - at least we will be competitive for manufacturing jobs again when we do away with child labor laws and minimum wage.
>>
>>52979673
lets see, who makes more money:

job

no job
>>
>>52979669
>being forced to work over 40 hours a week at a shit job cuz the economy is shit just to be able to pay rent in a trailer with some other dude isnt stealing my life
>>
>>52979673
This isn't a liberal or a conservative cause, necessarily. One interpretation of this fact is that tax revenue has exploded.
I could see this same quote with a Romney/Ryan pic behind it.
>>
Bernie is a gun grabber. That is literally indefensible.
>>
File: 1453700886029.jpg (81KB, 585x645px) Image search: [Google]
1453700886029.jpg
81KB, 585x645px
>>52979705
good thing he is going to stop tax loopholes of corporations keeping their money in tax havens to fund rebuilding americas crumbling infrastructure, which will provide millions of good paying jobs
>>
>>52979745
oh c'mon
>>
>>52979712
>paying excessive additional rent to the government
>paying excessive tax on your hard work to the government

>>52979746
>money = jobs
>>
File: graph.png (6KB, 459x365px) Image search: [Google]
graph.png
6KB, 459x365px
>>52979566
That's an implementation detail. You could do it completely without dicts.

Just to be clear, what do the numbers in >>52979421 represent? The edge cost? So like this pic?

Are you the one who asked the original question here >>52977862 ?
Are you suggesting that a dict is a generalized tree/graph because you can use it to implement a tree or graph?
>>
File: carlos.png (272KB, 560x560px) Image search: [Google]
carlos.png
272KB, 560x560px
>>52979745
>>
>>52979770
>getting paid by the government when you are in a shit position
>>
>>52979745
Without Scalia you can kiss your guns goodbye, dumb redneck.
>>
>>52979767

I'll come on nothing.
>>
>>52979798

I dislike Republicans, but if there's one thing they're good at, it's obstructionism. I cannot wait for them to absolutely stonewall Obummer on his USSC appointment.
>>
>>52979797
>being paid to fail

>>52979779
Sort of
>>
>>52979832
>believing you have full control about whether you will be successfull or not
>>
>>52979828
>Stonewall obama
>Bernie gets elected
>Warren on SCOTUS
No matter what your guns are gone, unless you're delusional enough to believe any of the GOP clowns can beat the bern.
>>
>>52979849
>temporary hardship doesn't exist
>charity doesn't exist
>small taxes don't exist
>>
>>52979871
>>52979871
>>52979871
new thread
>>
>>52979369
It's done, I think I did a solid enough job of it, let me know if there are any bugs.

(The Nuget package might take a little while to index).
>>
>>52979879
>porn
yeah nah, someone make a new thread
>>
GTP i'm calling you out on your anti type erasure bs


function signatures are type erased
>>
File: trump_disgusted.jpg (75KB, 600x450px) Image search: [Google]
trump_disgusted.jpg
75KB, 600x450px
>>52979857
Guns aren't going anywhere. You're delusional if you think 300+ million guns can be confiscated from people who are willing to die for them.
>>
>>52979832
>Sort of
What are you replying to?
>>
last posts (starting with >>52979746)
politics
politics
politics
algorithms
politics
politics
politics
~politics
politics
politics/algorithms
politics/algorithms
politics

daily programming thread. And it's fucking mid-February.

it's gonna be a long year
>>
>>52979919
>we can't take all the guns
>but we can deport over 10m people

>conservashit logic
>>
>>52979949
we're all programmers here daily
>>
>>52979857
>unless you're delusional enough to believe any of the GOP clowns can beat the bern.

They can and will. Guns are here to stay. God bless America.
>>
>>52979669
>providing good services for cheap / free = stealing
hey libertardian, who builds/pays for your streets and highways, and most importantly, why?
>>
>>52979952
>>but we can deport over 10m people
>>conservashit logic

Are you implying 10 million people can't be rounded up? Why are you denying the holocaust?
>>
>>52979987
i didn't say there was anything inherently wrong with taxation

there's no such thing as a libertarian anarchist
>>
Friendly reminder that Donald Trump was Patrick Bateman's role model, so unless you want the economy to be brutally murdered you'll vote for Bernie.
>>
>>52979992
(sigh)
Moishe, what the fuck. Last time we agreed it was six million, and we both know even that was a rip-off.
>>
>>52979992
If they'd had guns it wouldn't've happened
>>
>>52979952
The difference is that there is actually precedent for deporting millions of beaners :^)

https://en.wikipedia.org/wiki/Operation_Wetback
>>
>>52980009
>there's no such thing as a libertarian anarchist
HAHAHAHAHAHAHA
murricans and their political definitions...
>>
>>52979857
>Bernie gets elected

The DNC has already said that Bernie is not going to get the nomination. The liberal superdelegate system guarantees that Hillary will win. How does it feel to be used by a party to further the Clinton monarchy?
>>
>>52980057
there's no liberty without a state
>>
>>52980077
osgtp will disagree with you on that
>>
>>52979896
ok, what were you trying to achieve with the change?
>>
>>52980039

Right, and we know that's at least partially true thanks to the Warsaw Uprising and the Bielski Partisans.

Unfortunately, they were mostly unarmed.
>>
can someone troubleshoot this function in my java program?
    public static void executeSkill(Entity caster, Skill skill, Entity target){
if (skill.getHealing() > 0)
{
caster.setCurrentHealth(caster.getCurrentHealth() + skill.getHealing());
System.out.println(caster + " " + skill.getCombatText() + " himself.");
}
else{
damage(caster, target, skill.getDamage());
System.out.println(caster.getName() + " " + skill.getCombatText() + " " + target.getName());
}

System.out.println(skill.getSkillName() + " has " + skill.getBleedStacks() + " stacks of bleeding associated with it");

if( skill.getBleedStacks() > 0)
{
target.setBleeding(skill.getBleedStacks()); System.out.println(" BLEED"); System.out.println("");
}

target.setBleeding(skill.getBleedStacks());
target.setBurning(skill.getBurnStacks());
target.setPoisoned(skill.getPoisonStacks());
target.setChilled(skill.getChillStacks());
target.setStunned(skill.getStunStacks());
target.setBlinded(skill.getBlindStacks());

caster.setFocused(skill.getFocusedStacks());
caster.setVigilant(skill.getVigilantStacks());
caster.setFurious(skill.getFuriousStacks());
caster.setBloodthirsty(skill.getBloodthirstyStacks());
caster.setVengeful(skill.getVengefulStacks());
caster.setTenacious(skill.getTenaciousStacks());

System.out.println(target.getName() + " has " + target.getBleeding() + " stacks of bleeding");
}


and this is the output
 trsgh attacks GEORGE SOROS
Server Artery has 3 stacks of bleeding associated with it
BLEED

GEORGE SOROS has 0 stacks of bleeding
>>
NEW THREAD!

>>52980153
>>52980153
>>
Best unit testing framework for c++?
>>
>>52980150
No.
>>
File: Selection_004.png (5KB, 637x422px) Image search: [Google]
Selection_004.png
5KB, 637x422px
>>52975775
I'm learning Rust. I'm working on a roguelike written in Rust and the libtcod bindings.

So far I'm liking it. It feels like self-organizing C code with weird syntax.
>>
>>52975866
>>
>>52979745
>muh guns

You americunts look really stupid from this side of the atlantic.
>>
>>52980103
Switch from the BitmapImage return over to a byte[] so there's no reliance on anything, you can do whatever you like with the byte[] that way.

No point doing a conversion that people might not want.
>>
New Not ANIME RELATED Thread.
You Are Welcome.

>>52980203
>>
>>52980171
C O C
O
C
>>
>>52980233
literally what is COC?
>>
>>52980223
Nobody cares about the OP image you autist, fuck off.
>>
>>52980270
Stop shilling your weeb crap, seriously.
>>
>>52980257
Code of Conduct.

Rust is an SJW-hosted programming language, and basically if you aren't a full SJW then Rust will ban you from using the language.
>>
My only problem with bernie is his stance on abortion.
I used to be one of those people who supported the right to bear arms no matter what, but now I don't see it as much of an issue anymore.
If I support the 2nd amendment then it's because I see guns as a sort of heraldric symbol that it would be sad to deprive men of.
I would honestly prefer a united monarchy.
The french revolution was a mistake, and the united states being so influenced by it caused a lot of problems that we are now facing.
>>
>>52980292
inb4 the compiler bans "Slave" "Master" "Facts"
>>
>>52980292
yeah, sure
I'm not sjw at all, I don't give a fuck, and I like the language. sjw can suck my cock and you can go back to >>>/pol/
>>
>>52980283
>there's only one person on /dpt/ that doesn't want anime completely fucking banned
>>
>>52980283
I've literally never watched anime in my life, I just don't like people being autistic and double-posting new threads just because they don't like the image in the OP.

Kill yourself.
>>
>>52980321
I'm not meming, this is all very true.

Read for yourself if you don't trust me:
https://www.rust-lang.org/conduct.html
>>
>>52980349
I've read it. It's bullshit.
But you don't need to be part of "the community" in order to write code and produce binaries.
Thread posts: 344
Thread images: 32


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.