[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: 309
Thread images: 26

File: chailloux-manoury-pagano.jpg (40KB, 344x475px) Image search: [Google]
chailloux-manoury-pagano.jpg
40KB, 344x475px
What are you working on?

Old thread >>52902171
>>
File: 1438796298840.png (312KB, 506x662px) Image search: [Google]
1438796298840.png
312KB, 506x662px
this
>>
https://www.youtube.com/watch?v=mP7mXvGeaW8

need opinions on this bug.

why do you think it happens?
>>
Is there anything wrong with my implementation of quicksort? I have an interview tomorrow and want to be able to regurgitate algorithms, but I'm worried that this implementation might be inefficient, since many of the implementations I happen upon online are much longer.
private static void quicksort(int[] arr, int start, int end) {
if (end - start > 0) {
int wall = start;
for (int i = start; i <= end; i++) {
if (arr[i] <= arr[end]) {
int temp = arr[i];
arr[i] = arr[wall];
arr[wall] = temp;
wall++;
}
}
wall--;
quicksort(arr, start, wall - 1);
quicksort(arr, wall + 1, end);
}
}
>>
>>52909964
check your fucking cameras
>>
Fifth for javascript
>>
>>52909969
performs horribly in already sorted lists. people usually selects pivots better
>>
>>52909969
void quicksort(int x[10], int first, int last) {
int pivot, j, temp, i;

if (first < last) {
pivot = first;
i = first;
j = last;

while (i < j) {
while (x[i] <= x[pivot] && i < last) i++;
while (x[j] > x[pivot]) j--;
if (i < j) {
temp = x[i];
x[i] = x[j];
x[j] = temp;
}
}

temp = x[pivot];
x[pivot] = x[j];
x[j] = temp;
quicksort(x, first, j - 1);
quicksort(x, j + 1, last);
}
}
>>
>>52910034
I know, but no clue on why it hapens.

I guess is because I'm moving the camera and the camera is world coordinates while I store the hitboxes on screen coordinates.
>>
>>52910069
>I store the hitboxes on screen coordinates.
jesus that's retarded
>>
quicksort is garbage.
>>
>>52910112
I prefer sleep sort myself
>>
>>52910105
well, I'm new.

gonna have to remake my editor.
>>
File: IMG_20160210_174513.jpg (1MB, 3120x4160px) Image search: [Google]
IMG_20160210_174513.jpg
1MB, 3120x4160px
I found this in a room on the top floor of my university's college of business and economics.
>>
>>52910176

Why were you in the econ building?
>>
>>52910176
I don't get it
>>
>>52910139
never use screen coords except for Uielements or really rare cases when you know nothing will ever leave the screen and the camera will never be moved.

and always think in trees. in your case you would have the (abstract) node AutisticAnimuThing with two leafs: hitbox and sprite. The node itself would only represented by a point (or vector) in world coords. if you keep everything hierarchical you will not have as much problems.
and how would that look in reality: just use an entity component system https://en.wikipedia.org/wiki/Entity_component_system
or you write your own implementation.
>>
>want to write a lisp interpreter
>hey someone's written one in 90 lines of python maybe I could learn something from that
>see this
fucking python
>>
>>52910277
why
>>
>>52910277
>>52910317

Because it's meant to be succinct, rather than right.
>>
>>52909920
>Ocaml
>horse

That tells you how retarded the language is
>>
does anyone here seriously write unit tests?
>>
>>52910536
I did when doing .net.
>>
I will program anything that people suggest in the C programming language.
>>
>>52910536
Using QuickCheck, yes.
>>
>>52910536
working professionally, yes, who knows when some shit knob is going to change something on a whim and fuck it all up.

>>52910546
also doing .NET.
>>
>>52910277
Just read SICP, metacircular evaluator. It's chapter 4.
>>
>>52910584
my niggah
>>
>>52910514
The word for camel in French is different It wouldn't make any sense.
>>
what are easy but really fun shit to code that wont take more than one day.
>>
>>52910536
I try to but in the heat of shitting out code I just go directly to trying it out rather than writing tests.

For some things I'll go back and write tests in case it shits the bed if I change the implementation.
>>
>>52910782
RC4
>>
>>52910060
On average selecting a random pivot would make it run in average time, correct?

Also, is there anyway to make quicksort act like it's creating a self-balancing tree to keep worst case down to n*log(n)? Speaking of that why the hell isn't everyone using red-black tree sort?
>>
>>52910782
>what
os
>>
>>52910847
Even implementing SHA-2 is pretty easy from the pseudo-code on Wikipedia.

>>52910782
If you are experienced enough a simple LISP interpreter can be made in a couple days.
>>
>>52910909
>SHA-2
Sure but if you want to start with something it's MD4. Not useful but it's the basis for MD5, SHA-1 and SHA-2.

Change a few lines and you have all 3 of them.
>>
>>52910192

I have a work study job with a marketing professor. It doesn't make the best use of my skills, but it pays some of the bills.

>>52910194

The joke is that business degrees aren't worth shit.
>>
>>52910972
Never knew they were so similar. Yay, something to do tomorrow! Not the topic OP tho.
>>
>>52910514
O'Reilly already used the camel for Perl
>>
Can anyone recommend a good textbook on image/video/audio processing?

I am a C developer, but just work with network/systems programming would really like to learn.

Also starting on writing a dumb y4m player now with just X11 + stdlib
>>
>>52911006
If I remember correctly,

MD5 only adds an extra round(+ round function), also changes the shift/word access constants.

SHA-1 changes the internal block, constants and round function s.

SHA-2 does pretty much the same(changes all the variable parameters) just bigger and better. It's still the MD4 iterative hash algorithm at the core.

SHA-3 is different because they wanted a hash function that doesn't work that way, in case that way turns out to be shit.
>>
fn next(&mut self) -> Option<Self::Item> {
let mut c: u32 = 0;

let mut get_byte = || self.iter.next().unwrap().unwrap() as u32;

let b1 = get_byte();
if b1 >= 0xC2 {
let b2 = get_byte();
if b2 >= 0xE0 {
let b3 = get_byte();
if b3 >= 0xF0 {
let b4 = get_byte();
c = (b1 << 24) + (b2 << 16) + (b3 << 8) + b4;
} else {
c = (b1 << 16) + (b2 << 8) + b3;
}
} else {
c = (b1 << 8) + b2;
}
} else {
c = b1;
}

std::char::from_u32(c)
}


New to Rust, how do I make this code less shit? It parses a UTF8 char if it's not obvious.
>>
>>52911168
try naming some of your fucking variables for a start.
>>
>>52911168
Use a loop my man?
>>
>>52911168
> >=
Try using a bitmask, as you're supposed to.
>>
>>52911203
They are named. It's obvious b1 = byte1 and c = char.

>>52911209
How would you loopify this code?

>>52911220
That would increase the amount of cases needed would it not?
>>
>>52911262
// b1 = byte1
// c = char


would be helpful anyways Pajeet
>>
>>52911262
It would be the same amount of cases, although if you wanted you could make loop out of it

& 11000000
& 11100000
& 11110000

A loop there wouldn't help shit though.

Although notice the amount of bits you match are the amount of bits you need to read. That's a loop that would clean your shit up
>>
>>52910576
gameboy emulator
>>
>>52911349
>bits you need to read
*bytes
>>
>>52911349
fn next(&mut self) -> Option<Self::Item> {
let c: u32;

let mut get_byte = || self.iter.next().unwrap().unwrap() as u32;

let b1 = get_byte();
if b1 & 0x7F == 0 {
c = b1;
} else
if b1 & 0x1F == 0xC0 {
let b2 = get_byte();

c = (b1 << 8) + b2;
} else
if b1 & 0x0F == 0xE0 {
let b2 = get_byte();
let b3 = get_byte();

c = (b1 << 16) + (b2 << 8) + b3;
} else
if b1 & 0x07 == 0xF0 {
let b2 = get_byte();
let b3 = get_byte();
let b4 = get_byte();

c = (b1 << 24) + (b2 << 16) + (b3 << 8) + b4;
} else {
panic!("Invalid utf8");
}

std::char::from_u32(c)
}


So something like this?
>>
>>52911484
    uint8_t byte = ...;
size_t i = 0;

if ((byte & 0xC0) == 0xC0) i++; /* 11000000*/
if ((byte & 0xE0) == 0xE0) i++; /* 11100000*/
if ((byte & 0xF0) == 0xF0) i++; /* 11110000*/

/* read `i' more bytes */
>>
writing a disassembler

how to tell the difference between code and data?
>>
>>52911538
Sorry, that's wrong. too many ifs, possible increments. start from 0xF0 and 'else if' your way down to 0xC0.
>>
>>52911597
Nevermind, it's correct. I'm fucking retarded.
>>
>>52911568

The object header should contain information about where the .text, .data, .rodata, etc... Sections are located within the binary. I recommend actually reading the specification for whatever format you're writing a disassembler for, because if you had read it, that would seem like a silly question, and not reading it will not get you very far into your project.
>>
>>52911538
How would that work with combining them? Depending on the number of bytes you need to shift b1 by 0, 8, 16 or 24. I also imagine if statements would be faster despite being a little more verbose.
>>
Would appreciate it if people sent me some technical interview questions (maybe interview questions that you were given before?)
>>
>>52911670

Write some pseudocode to mirror/reverse a binary tree.
>>
>>52911665
Read it into a 4 byte array and cast it to a 32-bit integer.
>>
>>52911709
    uint8_t byte = ...;

size_t i = 1;

if ((byte & 0xC0) == 0xC0) i++; /* 11000000*/
if ((byte & 0xE0) == 0xE0) i++; /* 11100000*/
if ((byte & 0xF0) == 0xF0) i++; /* 11110000*/

uint8_t arr[4] = { 0 };
arr[0] = byte;

for (size_t j = 1; j < i; j++)
arr[j] = get_byte();

uint32_t result = *(uint32_t *)arr;


I think that's it.
>>
>>52911709
Casting arrays in Rust is unsafe and ugly.

>>52911813
In the case of 1 byte it should be in index 3.
>>
>>52911851
What about something along the lines of:

    uint8_t byte = ...;
size_t i = 1;

if ((byte & 0xC0) == 0xC0) i++; /* 11000000*/
if ((byte & 0xE0) == 0xE0) i++; /* 11100000*/
if ((byte & 0xF0) == 0xF0) i++; /* 11110000*/

uint32_t result = byte;

for (size_t j = 1; j < i; j++)
result |= ((i - j) * 8) << get_byte();


Sorry, I don't know rust. You'll have to excuse my dinosaur language.
>>
>>52911851

>unsafe
So?
>>
>>52911928
That makes sense, I'll see what I can do. Thanks.
>>
>>52911703
struct Node{
struct Node *right;
struct Node *left;
int num;
};

struct Node *reverse(struct Node *tree) {
if( tree->left )
tree->right = reverse( tree->left);
if( tree->right )
tree->left = reverse( tree->right);
return tree;
}


I didn't test it but I made sure it compiled.
>>
>>52911928
Nevermind that, byte is always on left most(arr[0] if you will). Keep track of the counter(j in this case) and add the byte after the loop.

Whatever, just fuck around with it.
>>
What is the moat accurate and portable (Windows and Linux) way of implementing timers in C++?
>>
>>52911670
You have two implementations of a sort function. One has an average case of n*log(n) and a worse case of n*log(n), while the other has a best case of n and a worst case of n^2. When would you use one function over the other and why?

Yes it's open-ended, but to see a particular opinion is the objective.
>>
>>52911953
Your computer might explode from leaving a few bytes of info in the heap
>>
>>52909920
Look at that nice round kerning.
>>
>>52911971

The problem with this implementation is that you lose information. After you set the right subtree to the reverse of the left, you have no more right subtree, so the left is now reversing itself.

What you want to do is swap the left and right subtrees, then reverse both.

Also, since I said pseudocode, it doesn't need to compile. It just needs to make sense.

>>52912045

Rust has stack allocated arrays, Anon.
>>
>>52912045
It happens man, us C programmers go through a computer every 2 days.

Explosions are just a natural part of life.
>>
>>52912008
#include <time.h>
>>
>>52912008
std::chrono::steady_clock is the way to go
>>
>>52912146
That's not a timer, buddy.
>>
I just did an extra credit for an embedded systems class, and learned something I did not know:

C has no bool type. I always thought it did. Neet. I'll probably get marked wrong on the assignment, but ALWAYS COMPILE WITH -Wall AND NAME YOUR C FILES CORRECTLY
>>
>>52912172
#include <stdbool.h>
>>
>>52912172
>C has no bool type.
Not technically but C99 has <stdbool.h>. You should use it in your programs if you use a boolean type.

The C way is 0 and not 0.
>>
>>52912172
There's no need for explicit booleans, ever.
You should be using enumerated types if you intend to pass status messages, you dumb shit.
>>
>>52912172
You're in an embedded systems class and you just noticed that? I find that a bit amusing.
>>
>>52912172
_Bool
>>
>>52912172
>AND NAME YOUR C FILES CORRECTLY
As opposed to... naming them incorrectly(or rather inconsistently) so that the build system can't find them?

What the fuck kind of advice is that?
>>
>>52912008
http://lazyfoo.net/SDL_tutorials/lesson12/

SDL timers. SDL 2.0 is zlib if you don't want to tell people you used SDL 1.2 (LGPL)
>>
>>52912224
Also remember to breath through your nose correctly
>>
>>52912243

Don't forget to remember to remember.
>>
>>52912257
Oh shit, I forgot about that one.
>>
>>52912191
>no need for explicitly bool
I'd argue if you had a byte 0, and wrote it's bits to another data type, it should overwrite a byte worth of data, not one bit.

>>52912217
Literally the class is just starting m8. We've programmed for years but since we'll be working with assembly the teacher is asking stupid stuff like this.

>>52912224
Well if you named it cpp and passed it to g++ it would compile as a c++ program, which has bool.

Are you guys really autistic or are you just joking?
>he asks in a prog thread
>>
>>52909969
start the pivot in the middle
>>
>>52909964
You're using hula-hooping sprites instead of combat stance sprites.
>>
File: 2016-02-10_23-42-20.png (319KB, 1583x628px) Image search: [Google]
2016-02-10_23-42-20.png
319KB, 1583x628px
so i finally got audio messages (mp3, ogg) working over multipart/form-data earlier this week... but now i can't send image formats (png, jpeg, gif) with the same code apparently. when i look at the packets i'm sending out i honestly can't tell what the fuck it is that i'm even doing wrong, they look to be correctly formatted AFAICT and it doesn't look like the images are being corrupted so i don't really know what's wrong. my only indication of error is the response i get from the Telegram API:
[Error]: Bad Request: there is no photo in request

pic related is proof that the same image is being sent and the HTTP request looks fine
>>
>>52912276
literally what the fuck are you even saying?

C booleans aren't needed, especially when you can just return a an arbitrary non-zero value to indicate success.
>>
>>52912157
>>52912229
What about Boost::Chrono?
>>
>>52912276
>Well if you named it cpp and passed it to g++ it would compile as a c++ program, which has bool.
Well no shit dude. I've got another shocking news for you, if you type out print("hello") and save it as script.py and then run it with Lua interpreter, it will also execute successfully, remember to always use the correct interpreter!
>>
>>52912276
>Well if you named it cpp
If you named it as cpp, gcc would also try to compile as C++.

Why the fuck are you naming a C file .cpp again?
>>
>>52912297
Why would you want to rely on boost::chrono as a third party library when C++ has now std::chrono in the standard that is basically a refined and improved version of the boost::chrono?
>>
>>52912292
You know there's `od' and stuff. You don't need to dump binary data to less.

For your thing I don't know fuck all about whatever telegram is but have you compared your request with that of another client or a web browser?
>>
>>52912294
>you can just return a an arbitrary non-zero value to indicate success
>using arbitrary values
There's a reason only Autists use C anymore.

>>52912318
You did a good job retard!

>>52912322
What kind of nigger names their c files cpp?
>>
Opinion time (OH_BOY.vbs):
Which is the best cross-platform scripting language?
>>
>>52912378
>You did a good job retard!
Thanks.

>What kind of nigger names their c files cpp?
That's literally what the dude you replied to asked.
>>
>>52912386
either perl, ruby, or python
perl and ruby have issues with windows, if I recall correctly
my dick thinks python is beautiful, so python
>>
>>52912378
>What kind of nigger names their c files cpp?

>>52912276
>Well if you named it cpp and passed it to g++

>>52912276 seems like a retard, right?
>>
>>52912403
Who was he talking to? Nobody named their c file cpp.
>>
>>52909920
how would i use wget to get an image from a website, without knowing what the image was called?
i want to make a script to scrape the images from r.sine.com
>>
>>52912414
So explain this thing, which you capitalized for emphasis:

>>52912172
>NAME YOUR C FILES CORRECTLY

And the follow up comment

>Well if you named it cpp and passed it to g++

If you're not him, your comprehension is non-existant.
>>
How do I git gud and not end up like Pajeet?

I feel like I'm going down a dark path and will never develop anything important.
>>
>>52912431
https://www.gnu.org/software/wget/manual/html_node/Following-Links.html

Read it, you'll never have trouble with it again.

Also after all that, go up a link and read the entire thing, should only take a few hours at most. You'll be a wget pro-l33t-super-downloader in no time.
>>
>>52912471
Take interest. It's the one thing that seperates monkeys from programmers.

What do you like?

vidya? write a simple video game.
chess? write a chess game and agent.
algebra? write a CAS.
anything? write it.

If you're trying to develop the next million dollar fart app, your path is only going to get darker.

Program what you want to program, if you don't know just read a related book until you get an idea.
>>
>>52912088
>After you set the right subtree to the reverse of the left, you have no more right subtree, so the left is now reversing itself.
Oh, wow, I didn't realize that. So now, it reversed it reverses the depth first.

void reverse(struct Node *tree) {
if( tree->left )
reverse( tree->left);
if( tree->right )
reverse( tree->right);
Node *tmp = tree->right
tree->right = tree ->left;
tree->left = tmp;
}
>>
>>52912372
it seemed like the binary data was the same when i diffed the files and it looked the same in od just now.
OH SHIT I FOUND IT I ACCIDENTALLY MADE A TYPO IN THE HEADERS ("multipat" instead of "multipart")
please disregard my retardation
>>
Anyone know why this particular piece of code will loop even if the input is "yes" or "no" (new to programming

while endProgram != "yes" or endProgram != "no" :
endProgram = raw_input("Error: please enter a either yes or no: ")
[
>>
>>52912446
I said make sure you name your c files correctly, because if you define bool but pass it to a c++ oriented compiler without warnings, it might not let you know you're using a type which shouldn't exist.
>>
>>52912569
But C99 has bool. Why define bool?
>>
>>52912510
This here.
>>
>>52912575
declare a* bool
>Autismos in charge of understanding others
>>
File: 2016-02-11_00-16-44.png (576KB, 1047x525px) Image search: [Google]
2016-02-11_00-16-44.png
576KB, 1047x525px
ayy lmao we real niggas now
>>
>>52912510
>reading
Probably what's missing to fuel my interest right now
>>
>>52912035
For most uses, I would choose the sort function with the average and worse case of n*log(n) because its average and worse case are more acceptable than the second function's worst case.

Since we don't know the best case of the first function or the average case of the second function, the most reliable function is the first one. I would only ever use the second function if I knew some sort of information beforehand about the list that would suggest it would work better with the second algorithm.
>>
>>52912566
I figured it out, now I am a little more confused. Appearently
while endProgram != "yes" and endProgram =!"no"

works but I'm having a little trouble understanding this. In the code preceding this if I enter yes when it prompts for input it will now end and if I enter no it will rerun the program. However why does this work seeing as the input validation loop's condition isn't really met because both conditions aren't true if endProgram only equals yes or no.
>>
>>52912566
Your condition is messed up.

Think about it, assume endProgram = "whatever".

Is endProgram != "yes"? of course it is: endProgram == "whatever".
>>
File: code.jpg (31KB, 607x902px) Image search: [Google]
code.jpg
31KB, 607x902px
>>52912660
If you don't have any interests, pick a book on a random subject.

This one right here is a very easy read, very informative and made me want to write a VM.
>>
>>52912629
>I said make sure you name your c files correctly, because if you define bool but pass it to a c++ oriented compiler without warnings, it might not let you know you're using a type which shouldn't exist.
>>
File: catalog4.webm (3MB, 1366x768px) Image search: [Google]
catalog4.webm
3MB, 1366x768px
Took a break from this project for a while but:
>finally cleaned up the HTML;
>added greentext;
>massively improved the RAM usage (down to <20 mb fullscreen);
>massively improved the line wrapper;
>added refreshing;
>added a status bar; and
>draw reply counts, image counts and thread numbers
Still neither posting nor viewing threads, but those will be coming next now that I've got the catalog to something decent as this
>>
>>52912879
Do you have a github for this?
>>
File: son.gif (102KB, 420x525px) Image search: [Google]
son.gif
102KB, 420x525px
>tfw your chess agent finally kicks your ass

Although I'm not very good, my heuristic function isn't that great.
>>
File: 1455132207951.png (568KB, 852x880px) Image search: [Google]
1455132207951.png
568KB, 852x880px
>>52912911
>github
I'm actually a bit self-conscious about my code, but if there's enough demand I might put it up somewhere for /g/
>>
>>52913012
It's just nice seeing something written in xlib.
>>
>>52909920
Golang 2.0 has been announced!
Featuring:
- Java style generics
- Optional manual memory management
- Much more...

Rob Pike announces the spec at GoCon 2016:

https://www.youtube.com/watch?v=dQw4w9WgXcQ
>>
>>52913067
Yeah, it's really tiny; the binary itself is just shy of 40 kb, and the RAM is mostly taken up by the currently loaded thumbnails (though there's currently a leak while refreshing, but it doesn't bloat the ram all that much, especially compared to icecat's ~400 mb)
>>
>>52913149
Kek the Embed onMouse preview fucks up your bait.
>>
File: Untitled.png (9KB, 469x226px) Image search: [Google]
Untitled.png
9KB, 469x226px
>>52913149
Anon...
>>
>>52913149
use tinyurl next time
maybe then at least one person might click it
>>
>>52913169
>>52913190
bah, should have used a URL shortener...
someone should start a new thread using that.. too lazy for that.
>>
File: 1437683162905.png (29KB, 633x758px) Image search: [Google]
1437683162905.png
29KB, 633x758px
>tfw can't find any code example on how to use animated decals on libgdx
>the libgdx wiki on animated decals say coming soon
>there's nothing on google
>>
I've been working on a shell script that splits flac+cue albums into tagged tracks using only the flac encoder and POSIX-defined shell syntax and utilities. I've written programs for school and recreationally (Euler Project, etc), but this is the first thing I've written that I think might be useful to other people, and also the first shell script of significant complexity. I put it up on github, which is the first time that I've used that, too.

It's now working pretty nicely and now has most of the features that I want it to have. There's one feature that I think might be worth adding, but I'm not sure. The reason that people keep flac+cue files, as far as I can tell, is that you lose some metadata when you split an album into tracks. Notably, you lose indexing information, like pregap positions. Flac supports embedded cue sheets, so I thought maybe I'd generate a small cue sheet for each track containing that track's index points. In the case of pregaps, they are appended to the previous track by default, so an index point would be added for that. Then, theoretically, another script could recompose both the original audio file and the original cue file, either by assuming that the last index point is actually the next track's pregap index whenever there's at least one after the initial one, or by looking for a Vorbis comment indicating that that's the case. I don't like the idea of adding non-standard tags like that, but flac does accept arbitrary tags ("standard" tags are standard by convention only), so if I wanted to I could add a tag that says "last_index_is_pregap=true".

What do you guys think? I'm aware that "cue" is a CD-related standard and as such may not be a relevant one for that much longer. Is it worth trying to save extraneous metadata to make file-splitting reversible? Is my program even useful?
>>
>>52909920
  for( i = 1; i <= 100; i++) {
three = i % 3;
five = i % 5;
if( three == 0 && five == 0 )
printf("FizzBuzz\n");
else if( three == 0 )
printf("Fizz\n");
else if( five == 0 )
printf("Buzz\n");
else
printf("%d\n",i);
}

please hire me
>>
>>52913149
Oh, I thought you were actually tell the truth and I had no idea why you put that link in. You are pretty old aren't you?
>>
Hey /dpt/ I was wondering how do you start a programming project. What steps do you follow.

Do you initially encounter a problem you know you could improve, and then you look for the tools to create it ?

Explain yourself
>>
>>52913264
stole it from some other site :^)

>You are pretty old aren't you?
how do you got to conclude this? old as in old 4chann user?
>>
>>52913230
>libgdx
people still falling for this meme?
>>
>>52913296
It was a meme, tolld u. lol. Sorry pretty drunk :^)
>>
>>52911168
>>52911484
How about this
let b = get_byte();

let (a1,a2,a3,a4) = match b {
0...0xC2 => (0, 0, 0, b),
0...0xE0 => (0, 0, b, get_byte()),
0...0xF0 => (0, b, get_byte(), get_byte()),
0...0xFF => (b, get_byte(), get_byte(), get_byte())
};

let c = (a1 << 24) | (a2 << 16) | (a3 << 8) | a4;
std::char::from_u32(c)
>>
>>52913276
Yes, as well as:

deriving user stories from your problem (basically things that the user will be able to do with your product so you can work on only a part at a time to stay organized)

thinking about what the users of your product would expect of it
>>
>>52913276
>Come up with idea, either from encountering a problem or doing research
>Determine if I can complete the project
>Determine if the project is worth completing
>Probably don't do the project
>Shitpost of /g/
>>
>>52909969
use "median of 3" for the pivot selection
>>
>>52913330
Looks good.
>>
>>52912732
Hah, you're his code should always run, because it could never be yes and no at the same time.
>>
>>52912404

>perl and ruby have issues with windows, if I recall correctly
Aside from compiling a few third party modules, Ruby plays fine with Windows.
>>
>>52913230
Use SDL and C. Never EVER use LibGDX.
>>
>>52913410
SDL and C++, C becomes hell with memory management at the long run. std::unique_ptr doesn't affect performance at all.
>>
https://www.youtube.com/watch?v=P1vVys5kmhM
>>
>>52913450
>using C++ with a C library

Anyone seriously using C++ for gamedev is going to roll their own memory manager anyway, so your argument is pointless.
>>
>>52913450
Anyways LibGdx is used for the game that is paying my salary at work. Some regressions are annoying like in 1.9.2 TextButton's label moves down if you scale the button for the touch down animation.
>>
>>52913459
Yeah because you need a custom made memory manager for a simple game. Are you going to write Battlefield you fuck?
>>
program THIS
*reaches inside and pulls cockandballs outand rests it on the table*
>>
>>52913459
>using C++ with a C library
what's wrong with this? It's fully compatible
>>
>>52913487
Get out.
>>
>>52913481
If it's a simple game then using C won't get to the point where memory management starts getting cumbersome.
>>
>>52913489
Nothing, retards just being retards.
back in the days, games in C++ always used C header for defining shit.
>>
>>52913522
It's just a simple C program, the programmer said. Gigabytes of memory still reachable, Valgrind replied.
>>
>>52913522
So what algorithm do you use to manage memory?
>>
>>52913557
a memory management algorithm of course
>>
>>52913557
Memory pools are simple and effective.
>>
>>52913592
Damn troll
>>
>>52913547
Isn't this exact problem with Java, that it can take shit tons of memory on simplest of tasks and yet it has garbo collector and shit.
>>
>>52913592
Anything more specific? I feel like repeated calls to malloc/realloc are a bottleneck.
>>
File: 1454425839678.jpg (25KB, 377x364px) Image search: [Google]
1454425839678.jpg
25KB, 377x364px
>he fell for the debugger meme
If you need more than printf() to debug your program, you are a bad programmer, plain and simple.
>>
>>52913622
>inb4("printf() is more taxing that your actual code combined");
>>
>>52913598
But that's exactly what you get with malloc or new...
>>
>>52913012
would use/10.
maybe it could add some image compatibility for sshchan and einchan.
try out einchan via
ssh [email protected]
password: ein
>>
>>52913640
he never said he doesn't use malloc.
>>
>>52913648
It's shit.
>>
>>52913487
Why was it necessary to reveal your gender on an anonymous imageboard? I want the attentionwhores to leave.
>>
File: 1424617350625.png (22KB, 566x361px) Image search: [Google]
1424617350625.png
22KB, 566x361px
I made OSX on Linux.
>>
>>52913699
its new
>>
>>52913747
That doesn't make it any less shit. It also spit out an ugly python error with a stack trace when I left.

Ignoring errors isn't any way to program anon, handle EOF correctly in your shit ein shell program.
>>
File: cup.jpg (29KB, 626x720px) Image search: [Google]
cup.jpg
29KB, 626x720px
>>52913799
>mine
>>
>>52913804
What?

Also fuck off with your meme anime.
>>
>>52913619
use lots of arrays :^)
>>
Can you dynamically allocate memory on the stack?
>>
>>52913940
Yes.
>>
>>52913940
Yes.
>>
>>52913941
>>52913942
How?
>>
>>52913948
C99 VLA or GNU C alloca.
>>
>>52913948
sub rsp, 64 // allocate 64 bytes on the stack
>>
>>52913948
alloca (it doesn't mean that you should though)
>>
>>52913948
int len = 10;
int xs[len];


I believe this allocates xs on the stack.
>>
>>52913980
Yes, that's C99 VLA. No guarantee it's on the stack though(although likely is).
>>
Just starting to learn Clojure. Installing Leiningeingien now.
>>
>>52914024
>Installing Leiningeingien
That's an absolute shit name for anything. Fucking germans.
>>
why can't i get a job
>>
>>52914052
Because you masturbate too much.
>>
>>52914057
that's actually true
>>
>tfw haskell has no decent GUI libraries
>>
If you had to choose between learning Clojure or Scala, which one would chose, and why?
>>
>>52914042
tfw generating jar using german

>lein uberjar
>>
>>52914098
C.
>>
test
>>
>>52911168
>>52911484
>>52913330
You don't appear to be parsing UTF-8 at all. Just sticking the bytes into a u32.
fn main() {
let arr: [u8; 3] = [0xE2, 0x99, 0xA5]; //
let mut iter = arr.iter();

let (b, n) = match iter.next().cloned() {
Some(b @ 0...0x70) => (b, 1),
Some(b @ _) => {
let n = (b ^ 0xFF).leading_zeros() as usize;
((1 << 7 - n) - 1 & b, n)
},
None => panic!(""),
};

let c = iter.take(n - 1)
.map(|&b| b & 0x3F)
.fold(b as u32, |c, b| c << 6 | b as u32);

println!("{}", std::char::from_u32(c).unwrap());
}

This doesn't exactly fit the original iterator code, but should be easy to adapt.
>>
>>52914120
Did it pass?
>>
>>52914114
>>decide between X and Y
>hurr durr Z

>>52914120
fail
>>
<code>test again</code>
>>
>>52914120
Serious this time,

<?php
echo 'test code';
?>
>>
>>52902171
i like how they deleted the "ur mom" but not the "kill yourself"'s
>>
>>52914124
That's pretty fucking ugly, didn't you faggots learn anything from perl?
>>
>>52914140
it's square brackets
>>
>>52909920
1) would you fugg that horse?
2) is there a good resource for advanced Golang? I'd say I'm familiar with the language, probably around 15k lines of experience, but I'd like to learn it more in depth...
>>
>>52914160

Most languages are ugly. Ruby's one of those few languages that can truly be beautiful, and ironically, it was partially inspired by Perl.
>>
>>52914196
>Ruby's one of those few languages that can truly be beautiful

Funny, I have yet to see that.
>>
>>52914196
This is the gayest thing you've posted this year so far.
>>
>>52914179
for q #2, ask here: https://webchat.freenode.net/?channels=go-nuts , Go has a shitload of docs and blog posts, though, and you can access those locally by running
godoc -http ":<insert_port_here>"
>>
>>52914124
Why do you shift it by 6 and not 8 when combining?
>>
>>52914207
Ruby is one of those few languages I have seen that can be as enlightening as Lisp, if not more so. Everything is an object, and every action is a method, which is also an object, and that's all there is to it.

>>52914218
In DPT at least.
>>
In C++, if I have three classes that all inherit from a single base class, can I create a variable that will only accept two of those classes instead of all of them? That is, via another way instead of making them inherit another abstract class. Or would that be the most suitable way to do it?
>>
>>52910514

>Most Python books don't have pythons
>Pandas book doesn't have a panda
>>
>>52914289
Isn't everything also an object in Python?
>>
>>52914348
Python OOP is pretty dumb though
selfselfself
>>
>>52914348
yes, but not in quite the similar syntactical way that ruby is, wit using certain operators etc
>>
>>52914160
My bitwise stuff must be too much for your simple mind.
Here is a dumbed down version:
use std::ascii::AsciiExt;
use std::char;
use std::u8;

fn main() {
let array = [0xE2, 0x99, 0xA5];
let mut iter = array.iter();

let (byte, num) = {
let &byte = iter.next().unwrap();

if byte.is_ascii() {
(byte, 1)
} else {
let num = leading_ones(byte);
(remove_left_ones(byte, num), num)
}
};

let val = iter.take(num - 1)
.cloned()
.map(remove_cont_header)
.fold(byte as u32, append_cont_byte);

println!("{}", char::from_u32(val).unwrap());
}

fn leading_ones(byte: u8) -> usize {
let flipped_bits = byte ^ u8::MAX;
flipped_bits.leading_zeros() as usize
}

fn remove_left_ones(byte: u8, num: usize) -> u8 {
let bitmask = (1 << 8 - num) - 1;
byte & bitmask
}

fn remove_cont_header(byte: u8) -> u8 {
byte & 0x3F
}

fn append_cont_byte(val: u32, byte: u8) -> u32 {
val << 6 | byte as u32
}


>>52914247
The most significant two bits in a UTF-8 continuation byte are always 10, and are not part of the number. Only the 6 least significant bits are important.
>>
>>52914363

Mind briefly explaining how? I'm not familiar with Ruby
>>
>>52914383
i havent used it much either but iirc there's stuff like basic types such as integers having methods you can just call when they're written as numbers (i think?) and stuff like pointing to a char in a string like this: "string"[0]. stuff like that.
>>
>>52914411

That still sounds like Python though
>>
I want to deepen my (little) knowledge of Haskell. Any project ideas, /g/?
>>
Anybody got any good resources for learning OpenGl?
>>
>>52914432

Python supports a number of things Ruby does, but in ugly as shit ways that involves loads of underscores. (seriously, __add__? I'm defining the method +, not __add__. Why make operator overloading a pain?). Also, Ruby has one nice little feature over Python in the form of blocks. What's so special about blocks? Simple: instance_eval. A Ruby block can be evaluated either in the context of the caller, or in the context of the receiver, depending on the whim of the programmer. When combined with method_missing, instance_eval can allow one to effectively create a domain specific language within a block.
>>
File: gameoflife.webm (1MB, 1494x780px) Image search: [Google]
gameoflife.webm
1MB, 1494x780px
I wrote a program that takes an image, and turns it in to a 2D array to be used in Conway's game of life.

How does it look /g/? Give me an image and I'll game of life it.
>>
>>52914528
Text editor, torrent client, game of life.
>>
File: 1454859392739.jpg (47KB, 460x464px) Image search: [Google]
1454859392739.jpg
47KB, 460x464px
>>52914624
>>
>>52914528
An interpreter for your own programming language.
>>
>>52914528
Web crawler.
>>
File: diss.webm (933KB, 474x499px) Image search: [Google]
diss.webm
933KB, 474x499px
>>52914808
>>
>>52914575
> seriously, __add__? I'm defining the method +, not __add__. Why make operator overloading a pain?.
__add__ conforms to the standard syntax for identifiers (thus not requiring special syntax rules for "operator" methods) while being something which code is highly unlikely to use for its own "normal" methods.

The extent to which the former matters depends in large part upon the point at which the feature was added to the language. Changing something as basic as token-level syntax once you have a significant installed base tends to be unwise (most mature languages suffer from this problem; C++ has it in spades).
>>
>>52914327
> In C++, if I have three classes that all inherit from a single base class, can I create a variable that will only accept two of those classes instead of all of them?
What do you mean by "accept"?

If the variable's type is a reference or pointer to the class, then it can be initialised from (or, in the case of a pointer, assigned from) and instance of or pointer to any derived class. That cannot be changed, so your only option is to refactor the class hierarchy so that the two permitted derived classes derive from some intermediate base class while the prohibited derived class doesn't.

If the variable is an instance, the initialisation and assignment are defined by the class' constructors and operator= respectively. However, overload selection is based upon static type, not dynamic type. If you want to accept or reject assignment or initialisation based upon dynamic type, you'd need a run-time check in the appropriate method. For static type, you can probably use templates to define an overload which will result in a compile error if it's ever instantiated.
>>
>>52914531
the reference manual
the opengl wiki
some tutorials might be decent
i haven't read the opengl superbible and it uses some sort of custom framework but for looking up how to do specific things it's alright
>>
>>52914364
match iter.next() {
None => None,
Some(b) if b < 128 => Some(b as u32),
Some(b) => {
let w = match b {
0xC2 ... 0xDF => 2,
0xE0 ... 0xEF => 3,
0xF0 ... 0xFF => 4,
_ => return None
};

let mut ch: u32 = (b & (0x7F >> w)) as u32;

for _ in 1..w {
ch = (ch << 6) | (iter.next().unwrap_or(0) & 0x3F) as u32;
}

Some(ch)
}
}


How's this?
>>
>>52915230
Much neater. I would still use take & fold, but that's just me.
>0xC2 ... 0xDF => 2,
Isn't that supposed to be 0xC0?
Although I suppose you could use that to check for invalid characters which use more bytes than necessary by using 0xC1, 0xE1 and 0xF1 receptively.
>>
>>52913940
why would you want that ?
>>
>>52915404
Why wouldn't you want that? You get to avoid the overhead of heap allocation.
>>
File: Video_1455188853.webm (1MB, 912x632px) Image search: [Google]
Video_1455188853.webm
1MB, 912x632px
Working on thread image downloader with filters and previews. Currently got stuck at webm implementations as you can see in the video. Is there some convenient way to play webm in Java? Only solution I found is Java bindings for VLC but that is robust solution with tons of unnecessary additions.
>>
>>52915317
Oh, yeah, good catch. Looping on a wild card is pretty ugly so I'll change it to take & fold.
>>
File: age.webm (2MB, 1280x720px) Image search: [Google]
age.webm
2MB, 1280x720px
It's time to ask your beloved programmer anything.

>>52914360
self argument does make sense but you need deep knowledge of oop and abstraction to figure why.

>>52915428
overhead is minimal and easily avoidable.

>>52914575
__add__ and + are two different things, their semantics are not the same.

>>52914289
>I have seen that can be as enlightening as Lisp, if not more so.

"Some may say Ruby is a bad rip-off of Lisp or Smalltalk, and I admit that. But it is nicer to ordinary people."
- Matz

>>52913622
backtrace > printf
>>
>>52915529
Is SQLite lighter in memory usage than something like MariaDB or Postgresql?
>>
>>52915529
Why is Haskell so based?
>>
>>52915540
Unless you run in entirely in memory, sure.
>>
>>52915529
>overhead is minimal and easily avoidable.
Which overhead? Heap overhead is MUCH higher than stack overhead.
If you have some shitty temporary buffer that is only has the lifetime of the function, it makes a lot more sense to allocate it on the stack.
>>
File: 1447649412575.png (173KB, 1024x1096px) Image search: [Google]
1447649412575.png
173KB, 1024x1096px
>>52915529
>self argument does make sense but you need deep knowledge of oop and abstraction to figure why.

Justify yourself.

That sounds suspiciously like "I'm used to it, fuck off"
>>
File: 1373662916812.jpg (171KB, 600x400px) Image search: [Google]
1373662916812.jpg
171KB, 600x400px
>>52915541

Do you ever think the joke about Microsoft using Haskell as its standard language had come true? Haskell.NET?

Simon Peyton-Jones: Well, there are two answers to this one – the first would be of course, yes, that would be fantastic! I really think that functional programming has such a lot to offer the world.

As for the second, I don’t know if you know this, but Haskell has a sort of unofficial slogan: avoid success at all costs. I think I mentioned this at a talk I gave about Haskell a few years back and it’s become sort of a little saying. When you become too well known, or too widely used and too successful (and certainly being adopted by Microsoft means such a thing), suddenly you can’t change anything anymore. You get caught and spend ages talking about things that have nothing to do with the research side of things.

I’m primarily a programming language researcher, so the fact that Haskell has up to now been used for just university types has been ideal. Now it’s used a lot in industry but typically by people who are generally flexible, and they are a generally a self selected rather bright group. What that means is that we could change the language and they wouldn’t complain. Now, however, they’re starting to complain if their libraries don’t work, which means that we’re beginning to get caught in the trap of being too successful.

What I’m really trying to say is that the fact Haskell hasn’t become a real mainstream programming language, used by millions of developers, has allowed us to become much more nimble, and from a research point of view, that’s great. We have lots of users so we get lots of experience from them. What you want is to have a lot of users but not too many from a research point of view – hence the avoid success at all costs.

>>52915554
most implementations of malloc are caching memory blocks.
once the kernel has allocated heap, it's as fast as stack memory.
>>
>>52915613
>most implementations of malloc are caching memory blocks.
>once the kernel has allocated heap, it's as fast as stack memory.
malloc has a lot of bookkeeping overhead. For the stack, literally all you have to do is add/subtract something to the stack pointer.
>>
Why do I never feel like making anything? I used to enjoy programming.
>>
>>52915682
>malloc has a lot of bookkeeping overhead
Such as? Once you have the pointer it should be exactly the same, only until you free the memory would it matter.
>>
>>52915747
>Such as?
Walking the internal list to find a memory block.
Creating an entry once it finds a block.
Joining adjacent free blocks.
etc.

Its shit like that why you shouldn't make excessive heap allocations.
>>
>>52915747
The much of the overhead lies in actually getting the pointer from the OS.
>>
Is it as bad of form in Python as it is in C to use break? I'm just starting proper Python coding and I'm seeing people recommend the below as a substitute for do-while.
while True:
stuff()
if fail_condition:
break
>>
>>52915790
how else would you break infinitive loop if not by using break?
>>
>>52915790
Who told you not to use break? Are you sure you're not thinking of goto?
>>
>>52915529
>overhead is minimal
everything is relative. for a bloated desktop application it's minimal i guess
>>
>>52915790
while not fail_condition:
stuff()
>>
>>52915782
Literally a matter of microseconds
>>
>>52909920
Any iOS developers here? Any good books/tutorials for Objective C/Swift/Xcode ?
>>
>>52915803
While (infinite) if (cond) infinite = false
>>
>>52915554
> Heap overhead is MUCH higher than stack overhead.
Only because stack overhead is effectively nil (like, one or two instructions, so a fraction of a clock cycle).

Once upon a time, heap allocation and deallocation used to be relatively expensive operations. But as both C++ (which uses it far more than typical C code) and high-level languages (which use it for practically everything) became more popular, allocation became a popular target for optimisation efforts.

The result is that malloc/free are now a couple of orders of magnitude less expensive than they used to be (i.e. typically one of them just grabs an existing block from a pool while the other just puts it back there, with more complex operations only performed intermittently, when you have an excess of one type of block and a shortage of another).

> If you have some shitty temporary buffer that is only has the lifetime of the function, it makes a lot more sense to allocate it on the stack.
While true in itself, there are other factors to consider. The main one is that the stack shouldn't be used for large allocations; if malloc() fails, it returns a null pointer which you can deal with. If you exhaust the stack (not necessarily in the alloca() itself, but possibly in subsequent stack frames because the alloca() left hardly any stack for "normal" use), the process gets terminated (exhausting the stack is often unrecoverable; e.g. 32-bit code typically maps DLLs/DSOs immediately below the stack, so there's no way to increase the maximum size once the process is running).

A secondary consideration is that if you extend the stack into unmapped memory, the resulting page fault will be many orders of magnitude more expensive than a heap allocation (of course, a heap allocation can also cause a page fault, but a recently-freed small heap block is likely to be in physical RAM, whereas extending the stack beyond the largest size it has had so far is quite likely to cause in a page fault).
>>
>>52915790
By not using an infinite loop in the first place? >>52915814

>>52915807
By lecturers and both of them. Maybe it was a training wheels thing so we didn't just break out of everything for no reason but it still seems like poor form.
>>
>>52915827
do that in C.
>>
>>52915835
>>>52915803
>By not using an infinite loop in the first place? >>52915814
>>
>>52915790
python is disgusting regardless, it doesn't matter what code style convention you use.

in your particular case, in a non-disgusting language you might do something like:

do {
stuff();
}while(!failCondition);
>>
>>52915835
break is the same as while or for. They are tools that can be used or abused by the programmer. Everything is fair game so long as you understand why you're using it.
>>
>>52915790
> Is it as bad of form in Python as it is in C to use break?
It's not bad form in either.

If used excessively or gratuitously, break can harm legibility. But so can most of the alternatives (e.g. staircase conditionals).
>>
>>52915152
>so your only option is to refactor the class hierarchy so that the two permitted derived classes derive from some intermediate base class while the prohibited derived class doesn't.
Yeah, that's precisely what I ended up doing. Cheers.
>>
>>52915840
bool done = false;
while (!done) {
stuff();

if (fail_condition)
done = true;
}

Is this supposed to be some retarded trick question?
>>
>>52915857
So, why not just

while (!done) {
stuff();

if (fail_condition)
break;
}
>>
>>52915857
You forgot this is C.
#define bool char
#define false 0
#define true !false
>>
>>52915865
so why not just

do {
stuff();
}while(!fail_condition);
>>
File: welcome back commander.png (34KB, 853x543px) Image search: [Google]
welcome back commander.png
34KB, 853x543px
>just discovering all these weird speech-synth talking-bear programming meme videos on youtube
Why do these exist anyway? It's more than one guy making them too
https://www.youtube.com/watch?v=bzkRVzciAZg
>>
>>52915868
<stdbool.h> has existed for at least 17 years at this point.
Stop acting like C89 is the only C standard.
>>
>>52915878
Why include a whole header file for just three lines? What else does it do?
>>
>>52915869
While do. always does one loop even if it's broken, this can be problem in some code.

also imagine nested loops.
>>
>>52915882
defines true and false.
>>
>>52915893
you start with while(true) so do..while is appropriate in this case
>>
>>52915902
So did I.
>>
>>52915882
http://ftp.netbsd.org/pub/NetBSD/NetBSD-release-6/src/include/stdbool.h
>>
>>52915905
I just don't understand why is break; bad.

I always use for loop because it's superior, rarely go for while loops.
>>
>>52915882
Newer C standards make sure to not add new keywords which will interfere with existing identifiers that would be found in already existing code.
That's why '_Bool' is the keyword instead of 'bool'. They know people don't want to write out _Bool, so they provide a convenience macro for new code and 'true' and 'false', which is inside <stdbool.h>. This allows old code to keep working (because they wouldn't have #included the file) and lets new code use the nicer words.
This does lead to absurdly short header files though, such as <stdnoreturn.h>, which (besides boilerplate) literally contains just
#define noreturn _Noreturn
>>
>>52915918
break isn't bad, just unnecessary most of the time
>>
>>52915913
yup, you pretty much did stdbool header on your own. for no fucking reason, good job.
>>
>>52915882
A WHOLE HEADER FILE?!

STOP THE PRESSES!
>>
>>52915930
>>52915926
If you aren't willing to reinvent the wheel don't use C.
>>
>>52915930
I mean you can't deny what fucking waste of disk space that is.

What, am I made of floppy disks?
>>
>>52915972
_Bool has semantics that you can't replicate yourself.
Use the fucking header you turbonerd.
>>
>>52915972
Well, next thing you need to do is create your own math.h
>>
>>52915981
WHAT ARE THE SEMANTICS

TELL ME YOU FUCKER
>>
>>52915981
I'm curious as to what they are.
>>
>>52915981
TELL ME

TELL ME NOW

SHITFACE
>>
>>52915981
>C
>Header has semantics

Dis gunna be gud
>>
>>52915997
>>52915999
>>52916005
Run this program and discover the answer:
#include <stdio.h>
#include <stdbool.h>

int main()
{
printf("%d\n", (bool)2);
}
>>
>>52915916
#define    bool    bool
#define true true
#define false false

It all makes sense now.
>>
>>52916021
That's for C++ code. Perhaps they did that to meet the requirement that 'true', 'false' and 'bool' are macros.
>>
>>52916011
I understand now, would it even be possible to do something like this with code?
>>
>>52915857
>>52915869
Using the while or do-while test doesn't work if the relevant information is only available part-way through the loop. You can't use "while", and do-while (which doesn't exist in Python) would require the remainder of the loop body to be nested inside a conditional. If there are multiple such tests, you end up with staircase conditionals with all of the real code (the stuff you're actually interested in) squashed into the right-hand margin.
>>
>>52916047
!!
>>
>>52916063
So how do you put that into the form (bool) ?
>>
>>52916048
stop using python you disgusting shitter

i only suggested do..while for the particular example where the condition is at the end of the loop body, not in the middle. use break if the condition is in the middle.
>>
>>52916047
In terms of doing it like a cast, no. _Bool is the only type that will covert any non-zero value to one.
You can use !! though.
>>
>>52916048
>not just using recursion
>>
>>52916091
>recursion
I was fpfags to leave
>>
>>52916091
kill yourself
>>
>>52916063
That has to be done explicitly. You can't write a bool macro (without using _Bool) such that >>52916011 works correctly.
>>
New thread: >>52916111
>>
>>52916077
> stop using python you disgusting shitter
Nope. I'm using Python and you can't stop me.
>>
File: Honeycam 2016-02-11 21-39-43.gif (2MB, 1280x720px) Image search: [Google]
Honeycam 2016-02-11 21-39-43.gif
2MB, 1280x720px
Game Programming.
currently I made the physics system using box2d.
Thread posts: 309
Thread images: 26


[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.