[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: 353
Thread images: 48

File: tree.png (124KB, 562x408px) Image search: [Google]
tree.png
124KB, 562x408px
Old thread: >>61755068


What are you working on, /g/?
>>
>>61763350
Hello World in 4chan text box.
>>
Already got some answers but i'm just gonna repost this here:

Sup faggots, /jp/ here and i've got a question.

I want to translate a Japanese game into English but i have problems with the pointers in the text data files.
The pointers always point to the first letter of the sentence. I edit this in hexadecimal.
When i add or remove letters from the sentence, the sentences after it will change and the pointers do not match the first letter anymore.
Which programming language would be able to help me create a program which changes the pointers according to the position of the first letter?
>>
>>61763431
Whatever they made the game in should help you. Specifically how they made the pointers and how the strings work. (Do they have to have the same length?)
>>
>>61763454
I'm pretty sure he needs longer strings because otherwise it's a no brainer since if they're equal, they will work just as if, and if they're shorter, you just append a null byte after your text.
>>
STRLEN
T
R
L
E
N
>>
>>61763488
what wrong with it anyway?
>>
File: dpt.jpg (56KB, 632x450px) Image search: [Google]
dpt.jpg
56KB, 632x450px
How would you implement a Google type autocompletion/autocorrect thing in a standalone app?
Is there a library for this?
>>
File: hex.png (89KB, 988x779px) Image search: [Google]
hex.png
89KB, 988x779px
>>61763454
Something like that.
I know how the pointers work, would just be a pain in the arse to do manually
>>
>>61763627
Depends what GUI library you're using, some of them provide such feature out of the box, otherwise you'd need some sort of a dictionary and fuzzy search then rendering the suggestions.
>>
>>61755681
>Someone wrote shitty code in OOP so OOP itself must be bad
No
>>
File: image_1.jpg (26KB, 528x528px) Image search: [Google]
image_1.jpg
26KB, 528x528px
More like daily rulecuck thread amiright. Clean my shit janitorfaggot
>>
>>61763857
every OOP codebase is shitty
Are you implying that everybody is shitty programmer?
>>
Anyone worked here with Android embedded development? I'm looking to get a very custom solution built. Where can I find some good starting resources?
>>
>>61763709
I guess null padding is the way to go then. Most likely your English sentences won't be able to get longer in bytes than the moonrunes.
>>
>>61763431
Literally any scripting language.

Just write a program that parses the sentences, save somewhere the base pointer for the first sentence and the pointers addresses, and then compute the new values when you're done translating.

>>61763876
Also this, except it won't work when you'll try to add context information that is required in english but facultative in japanese.
>>
>>61763869
yes, except myself
>>
File: 1337.jpg (58KB, 669x425px) Image search: [Google]
1337.jpg
58KB, 669x425px
I want to learn how to write automated unit and integration tests properly, in Java. Any good tutorials and reading material you'd recommend?
Should I just go for the documentation of frameworks and tools like JUnit, Mockito, Powermock, etc?
>>
>>61763934
>I want to learn how to BUZZWORDS and """testing""" in ENTERPRIZE LANGUAGE
are you sure though?
>>
>vsnprintf is leaking memory again
>>
>>61763438
>>61763446
That's wrong. standard library strlen() assumes that your chars are all 1 byte long, as it assumes that the first 0 byte will terminate the string. Anything that violates these assumptions will need a special library. If you're using strlen() on UTF-8 encoded text, for example, you should assume the result to be the amount of bytes and not the amount of chars. But that doesn't change much because UTF-8 is well designed, which is nice.
>>
>write a piece of code in javascript using higher order functions and manipulate data in a pure stateless functional way and elegant recursive solutions
>performance is trash
>rewrite it "C-like" with only loops and plain functions
>runs literally 100 (one hundred) times faster

What are some memes you fell for, /dpt/?
>>
>>61763962
I'm okay with simply going for the concepts and best practices, I just thought mentioning what I usually use could help.
>>
>>61763934
>write automated unit and integration tests properly, in Java
Nothing can be done properly in Java. Just wing it. That's the entire reason Java exists.
>>
>>61763995
High level programming languages have the issue that it's so easy to use inexpensive practices over expensive ones just because it looks better, when in reality the same can be done effortlessly without pointless language features much more efficiently.

The best example is the overused try: except: in python. It's at least 1000x less efficient than if-else and in most (if not all) cases it can be replaced by if-else effortlessly, just by knowing what to look for to avoid any error. Even adding if sanity_check(): goto fail in a few problematic places would be better.
The issue isn't the programming language, it's the shitty programming practices that it encourages.
>>
>>61763995
post the code

i bet it's shit
>>
>>61764090
>inexpensive practices over expensive ones
expensive practices over inexpensive ones, sorry.
>>
>>61764101
he already said he's using javascript
>>
>>61764090

the real issue is premature optimization of idiomatic code
>>
>>61763995
>javashit
>functional
>recursive
The thing with FP is you can depends on referential transparency to do aggressive code transformation and optimization to make up for the supposed abstraction overhead. Mean while JS's FP implementation is just trash. I mean, what ``functional language'' aside doesn't even do TCO?
Well there are Scala and Clojure but that's JVM's fault.
>>
>>61763962
Please stay away from working on anything other than FizzBuzz so that the world of computing is a safer place for all of us.
>>
File: 1501480051779.jpg (305KB, 1920x1080px) Image search: [Google]
1501480051779.jpg
305KB, 1920x1080px
>need to write a program that fetches some images from a website
>do it in python (requests, json, Beautiful Soup,...)
>takes a pain in the ass to write plus is slow as shit

>rewrite in bash using curl + sed+xargs+regex
>0.2 seconds

gotta love it boys
>>
>>61763995
>working with immutable data structures and unnecessary abstraction that doesn't get optimized is slow
no shit sherlock
>>
>>61763995
>Javascript
>C
Wow no shit
>>
File: 1502032737748.gif (15KB, 700x550px) Image search: [Google]
1502032737748.gif
15KB, 700x550px
>>61764101
It's javascript, of course it's shit.
I don't have the first version anymore, as I've completely replaced it with the other.

If you're confident you can do a better job than me, write, in javascript, an automata that take an image (around 60x60) as input, and simulates a fluid as in pic. I let you decide the inner mechanics as long as it's semi-realistic.

A black pixel is empty.
A blue pixel is the fluid.
A yellow pixel generates one blue pixel beneath it on each step.
Anything else is a wall.

It should be able to simulate at least 1000 steps per second.
>>
>>61764392
so that image is generated by reading from a file?

i prolly write it in C + SDL . it's not hard
>>
>>61764236
just surround your code with a giant try catch block noob lmao
>>
>>61764425
The goal is using a shit language with a shit paradigm the language wasn't designed to be using.
>>
>>61764446
so, how are you exactly making that gif?

are you using any external lib to render anything?
>>
>>61764483
Each step is written to a png file, when the program execution is done, I assemble the files with imagemagick.

Or you could make a webm with ffmpeg.
>>
>>61764506
why not use JS + HTML5 to render in the browser?

sorta like
window.requestAnimFrame = (
function(callback) {
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback){
window.setTimeout(callback, 1000 / 60);
};
})();
>>
>>61764575
Just do what the fuck you want.
>>
>>61763350
I'm taking a course in neural networks. I wana see if I can train a neural network to detect clickbait.
>>
>>61764598
artificial neural networks, you mean
>>
>>61764575
>that code
kek, gotta love """standards"""
>>
>>61764620
I mean yeah i'm not taking a premed course. I just figured that within the context of the thread it was fine to leave out the word 'artificial'
>>
>>61764641
you were mistaken
>>
>>61764634
that window's thing is to give support to firefox, opera, safari, chrome, etc..

i think there isn't another way of doing it?
>>
>>61764652
That's because you have autism.
>>
>>61764652
t. retard who can't figure out context
>>
>>61764662
>implying implications
>>
File: 333.jpg (275KB, 810x1080px) Image search: [Google]
333.jpg
275KB, 810x1080px
>>61764682
>>
>>61764656
that's what I'm talking about, idiots cannot agree on a standard way to do something and instead every vendor implements their own and people end up writing shitty nigger hacks like that
>>
>>61764733
would you like to have only one Operating System for every computer?
>>
>>61764733
Vendor prefixes are only required for backwards compatibility with older versions of the browsers, you don't need to use them anymore really.
>>
>>61764767
are you perhaps mentally challenged?
there's a thing that's called a standard, it defines the API, but instead, browser vendors break the standard, and create their own function names that do not adhere to the standard, I'm not sure how your analogy makes any sense whatsoever in this context

>>61764823
good to know
>>
>>61764832
>are you perhaps mentally challenged?
probably. don't even know anymore
>>
>tfw getting 900 euro for a programming job in yurop

can i live in my car and shower at the gym to save money?
>>
>>61764988
Where in europe? Depending on which country (and city) it's either decent amount of money or fucking nothing.
>>
>>61764988
what shit tier country do you live in? i get 600€ per day here in germany
>>
>>61765046
>>61765041
Portugal
>>
>>61765046
>i get 600€ per day
god help me. there are people here who get 600€ per month,

what do you do? work as a programmer?
>>
C++ IS THE GOD OF ALL LANGUAGES PROVE ME WRONG FAGGOTS
>>
>>61765089
Employed idris programmer
>>
>>61765111
kek
>>
>>61765089
freelancer programmer

this is before taxes of course
>>
>>61765131
why not working in a company?

wouldn't you earn more?

i guess i get your point. you have more liberty
>>
>>61764598
>I wana see if I can train a neural network to detect clickbait.
Easier just to blacklist known clickbait domain names.
>>
>>61764392
>decided to accept the challenge and try it on C++
>in the end, can't stop watching the gif while doing nothing
>>
>>61765185
i like wasting time with sorting algorithms

https://www.youtube.com/watch?v=kPRA0W1kECg
>>
>>61765159

working in a company is trading money for safety. i need to look for a new client every few weeks when i'm done with one project. but sometimes i just sit on my money and NEET for a few weeks. i like it
>>
>Essential Skills :-
>DSP
>C
>C++
>Assembler

>Desirable Skills :-
>Matlab
>Simulink
>>
>>61765185
But the challenging thing here is about doing it in functional-style javascript, not C++.

Typed languages are too easy.
>>
File: 1501111500130.png (913KB, 690x920px) Image search: [Google]
1501111500130.png
913KB, 690x920px
>>61765090
blue board
>>
Help me /dpt/, I'm about to tear my hair out. Trying to do some C.

if (guess[0] == 'm' && guess[1] == 'o' && guess[2] == 'a') {
puts("\nGETTING MOA BY MANUAL COMPARISON\n");
printf("strcmp returning: %d\n", strcmp(guess, "moa"));
}


Output:
GETTING MOA BY MANUAL COMPARISON

strcmp returning: 1


Context: I'm looping over all three-letter words (the above snippet is inside a triple-nested for loop). I use a char array called "alphabet" containing all the lowercase letters (I know I could just increment chars, but an array is more general, as it allows arbitrary alphabets if I want to do that in the future).

The function this is in literally has the three nested for loops, a strcmp to check if the words matches a known goal (in this case "moa"), and if it matches it it returns it (otherwise it returns an error value).

I'm calling this function multiple times (once per line for an input file), and the first time ALWAYS gives the above wtf. Starting with the second line (i.e. second time the function gets called), everything works as expected.

I'm at my wit's end. What could possibly do this?
>>
>>61765223
lol i had that when i graduated
>>
>>61765208
web dev?
>>
>>61765300
The problem is that you're using C
>>
>>61765300
check the value of guess[3], it's probably not '\0'. Maybe a newline or something.

strcmp looks for an exact match of the two strings from start to finish.
>>
Are design patterns important? Why can't I just create a custom one based on every custom problem?
>>
>>61765324
VR, interactive media. mostly Unity at the moment
>>
>>61763862
i don't get that image
my gf says that all the time and I see absolutely no problems iwth it
>>
>>61765415
you should look up the definition of "pattern"
>>
>>61765300
strcmp checks more than the first three characters
>>
>>61765300
post more of the code
>>
>>61765415
>Why can't I just create a custom one based on every custom problem?
Uh. That's exactly what you should do.
Design Patterns are good solutions to _known_ problems. If it's a new problem, create a new solution. Don't abuse design patterns lest they get in your way.
>>
>>61765410
>>61765450
Guess is a char[3], so there is no guess[3]

And it works perfectly the next time I call the function

>>61765482
Once I get back home, in 20 minutes
>>
>>61765518
There's your issue then, it has no null byte while the "moa" argument probably has it added to it at compile time. Make it a char[4] with a null byte forced at guess[4] and try again?
>>
php > all
>>
File: 1387995359399.jpg (60KB, 604x604px) Image search: [Google]
1387995359399.jpg
60KB, 604x604px
What's the time complexity of sorting an array of strings? Is it still n log n?
var foo = ['yes', 'no', 'maybe', 'i don\'t know', 'can you', 'repeat the question'];


For sorting such an array, is it only necessary to look at the first character the vast majority of the time, and sort relative to that character? We'd only need to check successive characters to resolve cases where the strings being compared both start with the same letter, which wouldn't happen all that often or to such a degree that each individual comparison would become non-constant time.

Is that right?
>>
>>61765415
No.
Use a real programming language.
>>
>>61765550
I don't understand why it would work later, but I'll try it anyway
>>
>>61765415
Design patterns are like generalizations of custom shit that you will write.
I think it's more about learning the terms to communicate with others and understand things quicker.
>>
File: Rust Programming Penguin.jpg (18KB, 284x339px) Image search: [Google]
Rust Programming Penguin.jpg
18KB, 284x339px
Which are your favorite programming penguins to program with?

https://www.youtube.com/watch?v=DxY0jMJbk-8
>>
>>61765697
I think those birds should live in their natural habitat.
>>
>>61765760
that shit ain't right
>>
>>61765760
so should programmers
>>
File: index.jpg (11KB, 225x225px) Image search: [Google]
index.jpg
11KB, 225x225px
>>61765697
>>
>>61765594
The string literal "moa" is stored in memory as the letters m o a followed by a null byte, so it's a total of 4 bytes. This null byte marks the end of the string, that strcmp and other standard string functions rely on to know when to stop processing.

You can test that by doing

char s[] = "moa";
printf("%ld\n", sizeof(s));


It will print the size in bytes of s.

strcmp will reach that last character, and see that there's a null byte at the end of string pointed by its second argument, but may or may not see a null byte following the "guess" pointer, as it will check outside of the storage specified by your pointer, which is undefined behavior.
>>
>>617655941
The guess variable has 3 bytes in memory:
{'m', 'o', 'a'}
The argument has 4 bytes in memory:
{'m', 'o', 'a', '\0'}

strcmp returned one, what probably happened is:
strcmp looks for the first different byte. It scans 'm' on both, scans 'o' on both, scans 'a' on both, sees that the '\0' ends the second argument but random garbage is on the first argument. The next byte is probably a '\0' at random, if not it would keep going until it found one or it segfaulted.

so it sees:
first argument: {'m', 'o', 'a', random byte, '\0'}
second argument: {'m', 'o', 'a', '\0'}
It returned one because the string has one byte more than the other.
>>
Trying to make vey simple physics simulation engine.

Anyone got some protips for finding collision between circle and OBB for absolute moron?
>>
>>61765565
O(mnlogn)
>>
>>61765928
What's an OBB?
>>
>>61765928
https://en.wikipedia.org/wiki/Hyperplane_separation_theorem

http://www.metanetsoftware.com/technique/tutorialA.html
>>
>>61765290
yea its amazing the stuff people post here on blue boards.
I actually had people sit there and argue with me that lolis getting raped by spiders isnt acceptable on a blue board, they insist there is nothing wrong with it
>>
>>61765090
God I wish that were me
>>
>>61765957
as far as i can see second link has AABBs, not OBBs
>>
There a good book on the C++ standard library?
>>
>>61765991
At least there's no porn dumps though
>>
>>61765550
Aasddfdffdsfds that actually worked

>>61765836
>>61765913
That makes a lot of sense, but I still don't get why it wasn't just failing all the time.

Oh well, it's working now, thanks a bunch guys
>>
>>61766024
https://wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/
>>
>>61766039
Tried this?

https://www.amazon.com/Standard-Library-Tutorial-Reference-2nd/dp/0321623215
>>
>>61766039
I'm also curious. >>61760262
>>
>>61766056
If you allocated your array on the stack, the value may or may no depend on the value of another variable in the same function. If it was pure random, it would be 1/256 chance to work, but obviously it's not pure random.
>>
>>61766056
Because you were running on the gamble that the next random byte was a null byte, and sometimes it was
>>
>>61766062
Have not, thanks senpai.
>>
>>61766112
>sometimes
Meaning every single time except the first time after the program was started, perfectly consistently.

>>61766100
Yeah probably depended on some other variable which would get set after the first iteration or something. Makes sense.
>>
>>61766139
It probably reused the same pages to avoid writing the whole thing to memory over again, so the gamble was reproduced nearly perfectly. Or it used pages that were previously entirely empty, which gives you 100% chances that the undefined bytes are null. There could be a lot of explanations to this, the only important one is that you were relying on pure chance.
>>
>>61765415
Like the others have said, design patterns are a generic way to talk about solutions. You know how you can say "use a for loop" instead of "declare a counter i and use it over a set of expressions i-times". Well, same shit. Design patterns won't solve your problems for you, but they will make it easier for others to understand your shitty solutions.
>>
>>61765415
Knowing design patterns makes life easier by not having you reinvent the wheel every time you make a program.

It's easier to learn general designs that come from years of CS research than to try to figure them out yourself. It's also more efficient in every way.
>>
>>61763995
JavaScript doesn't support tail-call optimization, so it's not safe to use it as a functional programming language.
>>
>>61764247
>requests, json, beautiful soup
Sounds like it's slow because you're retarded.
>>
>>61766437
>writting 100 lines of efficient code that can be solved in one line of bash and awk

there's no other way of doing web scrapping in python

or there is?
>>
>>61766039
I thought using only http://www.cplusplus.com/reference is enough
>>
>finished C++ Primer 5th edition
Hello fellow C++ programmers
>>
>>61766500
That's not how you spell http://en.cppreference.com/w/
>>
Where were you when skynet became real?

https://arxiv.org/pdf/1708.01226.pdf
>>
>>61766535
>>61766500
Both suck.
>>
>>61766562
Kizuna Ai will protect us
>>
Testing
>>
>>61766562
>pajeets.

No.
>>
>>61766411
When I removed my only recursive call I had only marginal performance gains.

The costly thing was function calls.
>>
>>61765760
>>61765771
when did this place become reddit?
>>
>>61766715
Archival evidence seems to indicate a large shift occuring around late fall last year
>>
>>61766921
This corresponds with the influx of trumpers to /pol/
>>
>>61766677
>>61766688
impossible digits
checked
>>
File: normiesunwanted.jpg (464KB, 1131x1600px) Image search: [Google]
normiesunwanted.jpg
464KB, 1131x1600px
Where were you when the functional programming revolution happened?
>>
>>61766688
Don't use a language with expensive function calls then baka. Are you really surprised that function calls are expensive in Javascript?

Also tail call optimization is not transforming recursion into loops:
> Intuitively, no space is needed for an active tail call because the continuation that is used in the tail call has the same semantics as the continuation passed to the procedure containing the call. Although an improper implementation might use a new continuation in the call, a return to this new continuation would be followed immediately by a return to the continuation passed to the procedure. A properly tail-recursive implementation returns to that continuation directly.
Tail call optimization should improve all tail calls not just recursive ones.
>>
File: karen haskell.png (818KB, 1280x719px) Image search: [Google]
karen haskell.png
818KB, 1280x719px
>>61767154
communists out

british imperialist languages only
>>
>>61767154
Programming in C. Still programming in C, the functional fad will go away eventually.
>>
>>61767154
in some other timeline, presumably
>>
>>61767252
>implying
The first relevant language was a functional language, then C happened, then its concept were developed into OOP, and now everyone wants functional programming again. It seems to me like procedural, imperative and object oriented lost.
>>
>>61767251
>from first principles
i had to double check that wasnt a thatcher reference
>>
>>61767329
no it's just the book subtitle
>>
File: c.jpg (2MB, 2000x2610px) Image search: [Google]
c.jpg
2MB, 2000x2610px
>>61767154
Strength through pointer arithmetic
>>
>>61767326
I didn't know that FORTRAN was a functional language
>>
File: ukip weeb.jpg (54KB, 1024x576px) Image search: [Google]
ukip weeb.jpg
54KB, 1024x576px
>>61767365
i know now, i just remembered that being a phrase thatcher said on an interview i once watched
>>
>>61767385
pointers are a powerful yet horrifically dangerous tool.
Only a fool thinks they can use pointers safely.
>>
>>61767406
>implying fortran was more relevant than lisp in the 60's
you could at least argue that assembly or punch cards were the first relevant language.
>>
>>61767436
>punch cards
>not jumper cables
>>
>>61767436
>implying punchcards were significantly different than asm.
>>
File: d3500-2.jpg (907KB, 3660x1976px) Image search: [Google]
d3500-2.jpg
907KB, 3660x1976px
>Not programming in analog
>ishygddt.f77
>>
>>61767385
>>61767154
/r/ing more of these posters
>>
Dumb C question
I know you can't declare functions inside structs, but can you declare function pointers?

Say you had a struct, 'point', defined as follows:
struct point
{
double x;
double y;

void (*print_function_ptr) (void); //is this possible?
}


Is it possible to somehow make a print_point function that acts on the structure itself?
>>
>>61767621
It can contain the function pointer, sure. But you'll have to define the function somewhere external to the struct.
>>
File: programminglangs.png (931KB, 663x6101px) Image search: [Google]
programminglangs.png
931KB, 663x6101px
how precisely do you go about transferring data that isnt in some basic java type between activities in android? id like to hand an object back from one activity to another, and pass that on to another, and i see no Object overloaded method that would be of use to me
>>
http://highscalability.com/blog/2013/5/13/the-secret-to-10-million-concurrent-connections-the-kernel-i.html

Does anyone know where I can get a driver to play with? Preferably for a popular relatively inexpensive network card I could buy.
>>
>>61767658
>JS
The author of this clearly doesn't know JS.
I like that.
>>
File: 1gw8yqg2.png (76KB, 987x871px) Image search: [Google]
1gw8yqg2.png
76KB, 987x871px
Reminder that the reason ADTs are better than classes is because the whole idea of a class or other kind of opaque data type is that you are coming up with a new type from scratch to store instances of your concept which is a huge waste of effort when you have ADTs which let you say that if you had a dedicated type to store instances of your concept then that type would just be an instance of some existing kind because the kinds and the way they interact cover all bases because that is the true nature of what it means to have an expressive type system
>>
>>61767621
Just use C++
>>
>>61767673
he also apparently doesnt understand swords, but oh well
>>
>>61767658
while rust is a 3d printed gun, lisp, being a programmable programming language, shall have been a 3d printer.
>>
>>61766411
>JavaScript doesn't support tail-call optimization
It does since ES6
>>
>>61767692
Do you often type 100-word sentences?
>>
>>61767621
>>61767621
>
struct point
{
double x;
double y;

void (*print_function_ptr) (point* this);
}

But you'd have to call it like:
struct point myPoint;
myPoint.print_function_ptr(&myPoint);


It doesn't do any of the polymorphic stuff either (but you could easily replicate that too).
It's a rather poor style to write C in. If you want this then you probably want Java, C# or C++ rather than C.
>>
>>61767621
Why not just declare a printPoint function and take a point as argument?
>>
File: bakabaka.png (510KB, 782x1238px) Image search: [Google]
bakabaka.png
510KB, 782x1238px
>>61767692
dumb frogposter
>>
File: 6df.png (84KB, 658x901px) Image search: [Google]
6df.png
84KB, 658x901px
>>61767807
Why are you calling me dumb if you agree with me
>pic realted: mfw
by the way yuo are dum instead. this is not normal "pay pay" frog meme, this is food help helper, are much beter mem
>>
>>61767835
frogposters like you don't deserve to talk to superior lifeforms like me
>>
>>61767835
>Why are you calling me dumb if you agree with me
Because your explanation is shit
>>
>>61767835
apustajameemu
>>
>>61767658 anyone?
>>
does anyone know how to make a border around a piece of string? I'm working on the canvas element in javascript.

so the text/font is of any x pixels with an arbitrary typeset (For now it's sans serif). How do I calculate a border around a (single) string/line of text?
>>
>>61767621
Yes this is C's equivalent concept to a class and is called an "opaque data type"
An opaque data type needs a
Eaxmple:
struct point {
double x;
double y;
void (*print)(void);
};
/* for best opacity make the member functions
static in the implementation file so they're only
exported via the struct */
static void print_point(struct point *this) {
printf("(%lf, %lf)", this->x, this->y);
}
struct point *make_point(double x, double y) {
struct point this;
this.x = x;
this.y = y;
this.print = print_point;
return this;
}
static void point_usage_example() {
struct point this = make_point(4.5, 2.7);
this.print(&this);
}
>>
File: 1493938642385.jpg (90KB, 957x621px) Image search: [Google]
1493938642385.jpg
90KB, 957x621px
>>61767875
yuo are reetord. post food help helper is not frogpost
>>61767878
no you're waifu
>>61767903
ye
>>
>>61767954
>struct point *make_point
oops that should return a struct point, not a struct point *, my bad.
>>
>>61767974
kys urself toadfag
>>
>>61767954
what's the benefit of this? why not just have the print_point function public. as far as i can see this is just wasted space, for the function pointer
>>
I have encountered a puzzling problem in C++ that I cannot really wrap my head around.
I have a structure which contains Windows handles, integers and some other information. I pass this structure by reference to a function, however the local reference within the function has some of the structure variables reset.

struct MyStructure{
...
};

MyStructure my_structure;
function(my_structure);

void function (MyStructure& local_structure){

}


What could be causing this? Wouldn't the reference simply pass the structure address? Why would some variables be zeroes and other not?
>>
>>61768126
Sounds wierd. Post more code
>>
>>61768126
It doesn't necessarily zero-initialise everything.
>>
>>61768220
struct MyStructure {
struct MyStructure2 {
...struct MyStructure22{
...
};
};
};

MyStructure my_structure;
function(my_structure);

void
function
(MyStructure& local_structure) {
struct MyStructure {
MyStructure22 (void *);
};
}
>>
>>61767251
Learning Haskell makes me feel dumb, but I like it.
>>
>>61767714
The hilt on a katana is removable baka. When you remove it, you're left with bit of metal with some holes in it.

It's not intentionally sharpened but it's still going to tear in your fingers. Grip onto some rebar and pretend its a sword for a while if you don't believe me.
>gloves
reduce dexterity
>>
>>61768262
>Learning Haskell makes me who i am
>>
>>61768262
it will make you smart
>>
File: s.png (210KB, 1680x1050px) Image search: [Google]
s.png
210KB, 1680x1050px
>>61763350
>What are you working on, /g/?

Exploring the deepest, darkest corners of Racket.
>>
>>61768290
parentheses hell AND bracket hell?
>>
>>61768220
//windowexample.h
struct WindowExample{

HWND hWnd;
HINSTANCE hInstance;
WNDCLASSEX wcex;

RECT screenArea;
int width;
int height;
int bitDepth;

img_buffer rawOriginalData;
HWND buttons[SELECT_ICON_COUNT];

};

void showSelectButtons(WindowExample& window);


//function definition
void showSelectButtons(WindowExample& window){

int screen_w = window.width; // assigned to zero, even though these were assigned before
int screen_h = window.height;
...
}


//calling code
WindowExample ex;
... //initialization, all values good here
showSelectButtons(ex);


>>61768235
The debugger displays some member variables as zeroes, whereas things such as hWnd still contain valid handles.
>>
>>61768290
you should just blot stuff out with black squares, it's safer than blurring
>>
How do I make my own Array/Array-like typeclass instance in Haskell? I just want to define (!).

I tried
instance Array MyThing where
(!) = undefined

but it tells me
‘!’ is not a (visible) method of class ‘Array’
(same for IArray)
>>
File: 1476230511376.png (81KB, 556x430px) Image search: [Google]
1476230511376.png
81KB, 556x430px
>>61768069
no u wrog
>>61768094
One benefit is that you can have different constructors that supply different functions for the pointer, and even swap functions out at runtime. That way, you have traits and interface-based polymorphism, all without classes or inheritance.
>>
>>61768283
you have no idea what youre talking about, do you?
>>
>>61768337
Yeah I'm some backtracking algorithm can probably just try letters from left to right testing to match the blur, particularly easily with monospace
>>
File: 12we.png (33KB, 556x430px) Image search: [Google]
12we.png
33KB, 556x430px
>>61768372
your png is now optimized
>>
>>61768350
Array isn't a type class, but IArray is
Import IArray instead.
>>
>>61768404
Yeah I had a feeling about that, problem is if I use IArray I just get the same message but with IArray instead
>>
>>61768335
Wierd for sure. So you're assigning values after you've constructed the object?
>>
>>61768422
Look up the documentation, or if you're using the REPL use
:i

IArray has
bounds, numElements, unsafeArray, unsafeAt
as minimal requirements
(you can use :i or :t in the repl to look at their types)
>>
>>61768387
I think I do though
>>
>>61768350
>Array/Array-like
>Haskell

Use lists or tuples and save yourself the pain.
>>
File: evenmoreoptimized.jpg (2KB, 556x430px) Image search: [Google]
evenmoreoptimized.jpg
2KB, 556x430px
>>61768397
now it's even more optimized
>>
>>61768461
I'm trying to change the time complexity of a memoized function
>>
>>61768427
The structure is a global variable and I assign all member variables pretty much straight away. When I pass it to function within the same .cpp file it works as it should and program proceeds as it should. Only when showSelectButtons is invoked and the structure passed to it, then some values are zeroed and the function cannot proceed since information is lost somehow.
>>
>>61768461
unboxed and (ST/IO) mutable arrays can offer pretty good performance, dunno if vector is better, the index autism is a bit pointless
>>
File: 1501449992225.gif (566KB, 300x300px) Image search: [Google]
1501449992225.gif
566KB, 300x300px
>>61768471
>>
>>61768447
Thanks, I'll see if I can figure this out on my own from here
>>
>>61763350
writing a mobile app to send buzz intensity and buzz durations over bluetooth to the pink dildo currently in my boipucci.
>>
>>61768552
you gonna get cancer in the testicles
>>
File: german long knife.jpg (39KB, 499x374px) Image search: [Google]
german long knife.jpg
39KB, 499x374px
>>61768460
then youre aware that there is a term for that "bit of metal with some holes in it"? in the west we call it a tang, and in most cases it does not have holes in it. instead western sword construction methods typically employ a tang that passes through the length of the handle and reaches the end of the pommel, where it is peened, thus holding the sword together. one noteworthy example of a western sword that does use this construction method however is the german langsmesser, which literally means big knife, and only uses them to avoid being catergorised as a sword and thus subject to restrictions on where it can be worn by medieval german lawmakers. in general, rivetted tangs are less robust than peened tangs, as there is less metal where one might expect to incur stress during use on the battlefield, and combined with metals inferior to our modern steels this may result in damage to the blades tang.

as for gloves, they absolutely do not reduce dexterity, anyone who tells you otherwise is a fucking idiot who has never actually used a sword. certain kinds of hand protection such as hard mitten gauntlets and other gauntlets with more robust thumb protection may however inhibit your ability to actually pull off some more complex techniques with the false edge of a sword.
>>
>>61768579
good, qt girls don't have testicles.
>>
File: xkcd.png (44KB, 740x633px) Image search: [Google]
xkcd.png
44KB, 740x633px
>>61763350
>>
>>61768664
>one more woman than male
fucking sjws...
>>
>>61768397
>here's a lossy conversion of your png with clearly visible artifacts
wow cool
>>
>>61768589
>I have never worn gloves
I'm not surprised given that /dpt/ isn't exactly an athletic or hands on board but still. Post how gloves don't reduce dexterity in >>>/diy/ and see what happens.

Also thanks I forgot what the proper name was. Although one of requirements for the longknife to be classified as a knife was that it had to be riveted though.
>>
File: out1.png (74KB, 556x430px) Image search: [Google]
out1.png
74KB, 556x430px
>>61768372
>>61768397

Optimized? More like modified!
>>
File: 33.jpg (20KB, 539x361px) Image search: [Google]
33.jpg
20KB, 539x361px
How to get into programming for hardware?
>>
>>61763431
Apparently you got only the executable, so the answer is disassemble it
>>
>>61768768
Learn C, Assembler, and electronics.
>>
File: DSC_6042.jpg (942KB, 1500x1000px) Image search: [Google]
DSC_6042.jpg
942KB, 1500x1000px
>>61768589
>>61768460
also, you missed the point of my post, the author clearly wasnt too concerned with the impracticality of the sword blade he drew, which i was poking fun at. the handle is the least of that swords problems.

>>61768710
nigger have you ever swung a sword in your life? swords and most tools are not directly comparable in terms of the levels of finger dexterity required to use them, a suitably made glove no more impairs your use of a sword than it does a hammer. if you can move your fingers and grip strongly with a glove, its no problem. just dont be a downy and use padded gloves with a sword, because theyll just loosen your grip and thus fuck your edge alignment.

>Although one of requirements for the longknife to be classified as a knife was that it had to be riveted though.
that was literally my point.
>>
>>61768785
>how do i get into programming hardware
>learn to program and learn hardware
thanks retard
>>
>>61768496
I did some further testing and it seems that passing by reference works normally when the function definition is in the same file as the global variable. Why would this be the case? Wouldn't global variable addresses behave same as stack addresses or are they not put on the stack?
>>
I want to use a statically typed language with a powerful type system but I hate waiting for the compiler REEEEEEEEEEEEEEE
>>
>>61768825
Haskell
>>
>>61768832

wrong
>>
>>61768849
tripfag retards out
>>
>>61768832
too slow, at both compile time and runtime
>>
>>61768805
The fact that you couldn't even think about it makes you an even bigger retard.
>>
>>61768447
Okay, I'm totally lost on matching the kinds of my type to IArray
so I'm just going to give up and define my own separate functions on my type. I can make my implementation more specific that way anyway I guess.
>>
>>61769053
IArray is really weird.
They decided for some reason to parametrise it on an arbitrary index type.
>>
How do normalized device coordinates and the viewport work in opengl? I just need 2d shapes on the screen, but they are stretched when the viewport is not a square.

So let's say I pass a simple triangle to gl_Position with vec4(x, y, 0.0, 1.0), what the fuck happens after that? Does it go just like that to normalized device coordinates or does opengl do something with it inbetween?
>>
>>61769075
Yeah, I can tell that's powerful but it makes it super hard to just make your own IArray since you have to meet that generality with your own definition. Is this something I could solve with RebindableSyntax?
>>
>>61767692
That's a stupid argument because you can achieve the same thing with classes using multiple inheritance and generics ("the same thing" being an expressive type system whereby any desirable type can be trivially constructed as an instance of an existing kind)
>>
>>61765090
C++ is the worst language of all time. It's a substandard language. It's made even more worse by all the substandard programmers using it. If by using C keeps C++ programmers away it's a valid reason to use C in your project
>>
File: shiggy.jpg (5KB, 200x200px) Image search: [Google]
shiggy.jpg
5KB, 200x200px
>>61768698
kek
nice satire
>>
>>61768825
c++
>>
>>61769309
>C++
>"""""""Type"""""""" system
Fuck off pajeet
>>
>>61769309
>c++
>fast compiler
choose one and only one
>>
>>61769164
X axis ranges from -1 to +1
Y axis ranges from -1 to +1
Z axis ranges from 0 to 1.
If you don't apply any matrices or anything in the vertex shader then (-1,-1,0) is where you'd expect it to be.

Multiply your x coordinate by height / width of your screen to make your triangles square again.
>>
Tell me why I shouldn't use LGPL v3.0 for my libraries.
>>
>>61769318
>>"""""""Type"""""""" system
literally just don't use classes
do everything with variadic template structs
>Fuck off pajeet
fuck you, the reason there are many indians who don't poo in loo is because of their fucked up caste system and is not their fault, educate yourself asshole
>choose one and only one
i choose both because the c++ compiler is reasonably fast and fast as fuck as compared to shitlangs such as haskell and idris and if you manage to make the c++ compiler slow that is your fault for writing bad c++ and not pure innocent simple c++ that consists entirely of variadic template structs
>>
>>61769371
>variadic template structs
If I wanted to write in a crippled language then I'd choose a much more pleasant one than C++.
>>
>>61769371
>literally just don't use classes
C++ is C with classes, pajeet
>>
>>61769349
You can't dual license them to make money off of them.
>>
>>61769382
no you wouldn't because then you would not have a statically typed language that doesn't make you wait for the compiler
>>61769390
variadic template structs
>>
>>61769390
>pajeet
also: stop fucking making fun of indians who do not have the social privilege of pooing in loo you fucking ignoramus
>>
>>61769423
>variadic template structs
hohoh so badass
>>
>>61769443
>hohoh so badass
by mocking my supposed attempt to look badass you are incorrectly assuming such an attempt was made which indicates to me that you're missing the point of this conversation
>>
>>61769423
You forgot the bit about having a powerful type system. That's important. If I would be happy with C#'s type system then I'd probably use C#.
>>
>>61764392
this is cool as fuck. how do I do this?
>>
>>61769459
Drop the mental gymnastics
>>
>>61769410
Why not? As the library owner wouldn't I have the right to license it separately?
>>
File: 1500903271191.jpg (187KB, 598x465px) Image search: [Google]
1500903271191.jpg
187KB, 598x465px
>>61769331
I see, so the whatever I put into gl_Position is literally the NDC that comes out, no fuckery going on?
Thanks for the explanation.
>>
>>61769463
C++ does have a powerful type system
The power therein is simply ugly
You never said you wanted a PRETTY type system
Example:
template <typename... Ts>
struct variant {
// implementation irrelevant to point
};
struct nothing {};
template <typename T>
using maybe = variant<T, nothing>;
>>
>>61769522
I never said that C++ doesn't have a powerful type system.

I said that (the subset of C++ that you're suggesting I use) doesn't have a powerful type system.
>>
>change password
>nothing fucking works anymore
plssssss
>>
File: 3807208431722048426.jpg (47KB, 637x579px) Image search: [Google]
3807208431722048426.jpg
47KB, 637x579px
how do I practice programming? Nobody has ever told me that
I'm not a complete beginner but I'm not on a level where I could work on building something worthwhile either
When I'm at college I get assignments and shit but now with summer vacation and everything I have at least 2+ hours of free time every day I could fully allocate to getting better at coding but I don't know what to do
I just poke at stuff and walk circles, the time would be much better spent focusing on a single thing but what is that I don't know

Is reading books the answer? because I've never done that before...
>>
>>61765208
> but sometimes i just sit on my money and NEET for a few weeks. i like it

living the dream
>>
>>61769544
Reading books can help but only if you do the exercises in them too
>>
>>61769544
Try doing something you haven't done yet. Here, have this one easy trick to getting gud at anything: Keep moving outside your comfort zone
>>
>>61769476
I am guilty of no mental gymnastics
The only mental gymnastics between the two of us is your attempt to throw shade over your rhetorical defeat by falsely accusing me of attempting to look badass
>>
>>61769532
>able to correctly define maybe
>not powerful
pick one
>>
>>61769459
>>61769567
And people say C people are mentally ill
>>
>>61769522
>using maybe = variant<T, nothing>;
How is it different from Rust's result or option enum?
>>
File: start rolling.png (378KB, 1450x1080px) Image search: [Google]
start rolling.png
378KB, 1450x1080px
>>61769544
pick some easy ones and work your way up
>>
>>61769583
Being able to define maybe does not make it powerful. It merely makes it not completely unusable.
>>
>>61769589
A one-trick pony I see
Once again you scramble to cover up how badly you lost to three simple words ("variadic template structs") by turning the focus to the irrelevant question of my mental health
>>
>>61769489
Poster who replied to you is missing out on a more detailed explaination, and gave you an incorrect solution.

Without knowing what your final scene is supposed to look like in terms of how many objects you will be adding and their positions, at the very least you need to introduce a projection matrix into your triangles final position calculations. Whether you do this on the CPU side or send it to the Vertex shader function and do the multiplication there, by not mulitpliying your local vertices (which you have defined in your code as hardcoded values I assume), with the projection matrix your triangles will looked warped on anything other than an exactly square screen.

I understand you are doing a 2D scene, but you would benefit from introducing a camera class into your project which would contain a View matrix and a Projection matrix, both of which would be multiplied by your triangles vertices before being drawn to the viewport so no warping occurs.
>>
>>61769638
>projection matrix
>2d
Anon please. This also removes the ability to use the depth buffer for layers.

The solution I gave is the solution I use too.
>>
>>61769616
oh i see
so the snob type eh
WELL!!!:
reminder that types are unnecessary and it's far superior practice to just write every program as a sequence of untyped operations over processor words
>>
Well, here it is. Infinite lazy arrays in Haskell with O(log n) access. Can be used for memoization and such.
golomb = getvec $ vector $ map calc [0..]
where calc 1 = 1
calc n = (1+) . golomb $ (n-) . golomb $ golomb $ n - 1

I could make it O(1) practically speaking by making the central list another array instead with a fixed size that's 64 or something (so no computer on earth could have enough memory to fill it, lol).
{-# LANGUAGE MagicHash #-}
import Data.Array.IArray
import Data.List
import GHC.Exts
import GHC.Integer.Logarithms

data Vector e = Vector Integer [Array Integer e]
vector xs = Vector start $ makevec 0 start xs
where start = 1

makevec :: Integer -> Integer -> [e] -> [Array Integer e]
makevec idx size [] = []
makevec idx size xs =
listArray (idx,idx+size-1) chunk : makevec (idx+size) (size*2) left
where (chunk, left) = genericSplitAt size xs

getvec :: Vector e -> Integer -> e
getvec (Vector start arrs) idx = (arrs !! arridx) ! idx
where arridx = I# (integerLog2# $ idx `div` start + 1)
>>
>>61769489
No it's not technically normalized although it is in practice because you're not touching the 4th coordinate. I hope you're not touching the 4th coordinate anyway. Leave the 4th coordinate to perspective matrices.
>>
>>61769682
>arrays
>O(log n) access
>>
>>61769605
How is that in any way an operative predicate for this discussion?
>>
>>61769702
Yes, it's completely wrong. Array access takes O(sqrt(n)) time.
>>
>>61769730
No, dude.
Arrays.
This is arrays we're talking about.
Unless your primary memory is some kind of piece of shit, access should be O(1).
>>
>>61769787
http://www.ilikebigbits.com/blog/2014/4/21/the-myth-of-ram-part-i
>>
Remember to use GPLv3 for your next project!
>>
>>61769484
There's almost no reason to buy a license to use a library in proprietary software if the library is lgpl. Lgpl just means you have to keep the library as a separate dll/so instead of statically linking it.

Choosing regular gpl means that companies who like your software actually have to pony up (or break the law) to use it in their proprietary software.
>>
>>61769925
I see. thanks anon
>>
>>61768387
Is this a response from katana fanboys?
>>
>>61769691
So opengl does the division by w with whatever I put into gl_Position, I got that right?
>>61769638
Really no need for a whole matrix, I got my triangles down to 20 bytes of data each, 2 dot products, one addition, one subtraction and one multiplication. Height / width works fine with that. Just want to understand what exactly the driver is doing.
>>
>>61769953
nah, just a /k/ shitpost
>>
>>61769722
Eh, You have to implement result by yourself in C++ which is probably flawed too, C++ truly sucks
>>
>>61769972
*20 floats, my bad
Instancing is nice.
>>
>>61769986
>How is that in any way an operative predicate for this discussion?
>>
>>61770017
*tips fedora*
>>
>>61767696
this is actually good advice.

I wrote C "classes" this way and when I refactored to C++ the code got way better. If you're gonna do OOP, just use a language that supports it.
>>
>>61770029
No but seriously how have any of your past three posts contributed anything to the topic at hand? I get that you want to talk about Rust but has it ever occurred to you that not every conversation about programming in general must have something to do with Rust?
>>
>>61769702
Here anon, now it's amortized O(1), even though it doesn't actually matter.

data Vector e = Vector Integer (Array Int (Array Integer e))
vector xs = Vector start $ array (0,64) $ [(i, arrs !! i) | i <- [0..64]]
where start = 1
arrs = makevec 0 start xs

makevec :: Integer -> Integer -> [e] -> [Array Integer e]
makevec idx size [] = []
makevec idx size xs =
listArray (idx,idx+size-1) chunk : makevec (idx+size) (size*2) left
where (chunk, left) = genericSplitAt size xs

getvec :: Vector e -> Integer -> e
getvec (Vector start arrs) idx = (arrs ! arridx) ! idx
where arridx = I# (integerLog2# $ idx `div` start + 1)
>>
>>61770100
Not that you actually understood any of my code in the first place, most likely...
>>
>>61770052
>No but seriously how have any of your past three posts contributed anything to the topic at hand?
What logic are you on about? I simply asked how is that snippet of yours is any different than Rust's result and option and you kept asking the same question. If you don't know the answer don't respond or say you don't know. Simple
>>
>>61770137
I refuse to dignify that question with an answer on account of its irrelevance to the conversation into which it was initially interjected.
>>
>>61770154
Your answer is not going to ``dignify`` anything, what makes you even think that way. No matter what you say in response to this this >>61769986 will remain true
>>
>>61769544
>choose language
>google best books for it
>google the one you like with pdf at the end
>download pdf
>???
>profit
>>
File: 1499336041867.jpg (143KB, 550x512px) Image search: [Google]
1499336041867.jpg
143KB, 550x512px
>>61770100
>>61770117
Why did you create this?
>>
>>61770175
That thing you linked that you're saying "will remain true" is also irrelevant to the conversation you're barging in on.
>>
>>61770199
Seems like you suffer from mental delusion of thinking "everything I don't like is not relevant"
>>
>>61770183
libgen dot io is better than Google at this
>>
>>61768290
what theme and font?
looks really good
>>
>>61770212
It's not a matter of what I do or don't like. It's simply not relevant. What Rust can do is not relevant to the question of whether variadic template structs in C++ are a powerful type system.
>>
>>61770194
To memoize functions using infinite lists easily without monads.
>>
>>61770286
What's so ``powerful`` about variadic template structs again?
>>
>>61769972
Yeah it does that after the geometry shader and before the fragment shader, in the vertex post processing stage. I gave more of an empirical answer of "this will work." What the actual graphics card is horribly complicated.

https://www.khronos.org/opengl/wiki/Rendering_Pipeline_Overview#Clipping

You don't get any benefit from using a matrix though. All you need are is a vec2 (x,y) offset uniform and a float aspect ratio uniform.

I doubt you're memory or bandwidth bound though so there's no need to compress triangles into 20 bytes. You're only saving one float over just having 3 vec2s, and if you want texture coordinates you can use normalized GL_UNSIGNED_SHORTs for a mere total of 36 bytes. Your vertex shader should be essentially passthrough, minus aspect ratio correction and offsetting by the camera location.

I'd be fucking shocked if you were anything but CPU bound in a 2D OpenGL application, even on an integrated graphics card from 5 years ago.

And even if you were driver bound, you'd be much better off implementing AZDO tricks rather than packing bits for the vertex shader to unpack.

Be weary of premature optimization.
>>
>>61770307
Or other methods of passing an array around, take your pick
>>
http://www.ccs.neu.edu/home/matthias/HtDP2e/
>>
>>61770329
template <typename... T>
struct variant {
// implementation
};
struct nothing {};
template <typename T>
using maybe = variant<T, nothing>;
>>
type AppendTuple<T, U> = (*T, U);
f(*(a, b), *(c, d, e), f) => f(a, b, c, d, e, f);
>>
>>61770359
Did you read the question?
>>
Um its a little biggoted to assume all of us identify as having a face. I know this is an imageboard but just because you CAN post images doesnt mean you need to. And actually assuming that i identify through a picture is ridiculous because you have completely generalized me as a certain type of poster when in fact i am a text poster. Furtheremore do you have any idea how many pointless data is spent on image hoarding? Statistics show that 90 percent of images are OC with 99 percent being posted less than 5 times. I feel like we as text posters need a little more representation. I mean this is called an imageboard but what about being called a Image & Textboard. Honestly i think 4chan is best when we work together. Please be more considerate next time you make a thread.
>>
>>61770391
Bitch I wrote the question. All you did was reiterate it.
>>
File: 4bc (1).png (24KB, 165x115px) Image search: [Google]
4bc (1).png
24KB, 165x115px
>>61770407
>(You)
>>
>>61770413
>Bitch I wrote the question.
Wrong, I was the one who asked what's so ``powerful`` about variadic template structs. Why are you changing the topic?
>>
>>61770245
oh wow, thanks
>>
He thinks they're powerful because you can define basic data types with them.
>>
>>61770437
I ain't. This is an answer: >>61770359
But the fact remains that I was the one who originally asked and also answered that question. All you did was ask it again.
>>
>>61770468
So just like pretty much any other language? So far I haven't been impressed
>>
>>61770483
Yeah, he seems quite dull and unimaginative.
>>
>>61770476
>This is an answer:
That doesn't seem anything out of the ordinary. It's just as `` powerful `` as defining a "struct"
>>
>>61770483
>So just like pretty much any other language?
No.
You can't do that shit in C.
>>
>>61770502
Anything that's programmable can be done in C
>>
>>61770494
>template
>using
>>
>>61770518
Yes
>>
File: .png (98KB, 1131x879px) Image search: [Google]
.png
98KB, 1131x879px
>>61770524
>>
>>61770514
>trying to do functional programming in C
>>
>>61770548
>Run out of argument
>Post reddit frog
>>
>>61770558
(*)()
>>
>>61770584
Now do an actual program.
>>
File: 1496810915969.jpg (98KB, 1456x896px) Image search: [Google]
1496810915969.jpg
98KB, 1456x896px
>>61770559
>reddit frog
no you fucking idiot it's food help helper
also:
>run out of argument
>post "Yes"
>>
>>61770548
>>61770608
Dumb frog poster
>>
>>61770608
go back to réddit fag
>>
>>61770608
Take your reddit frog to reddit
>>
>>61770608
>>61770548
Fuck off, you fucking redditor.
>>
>>61770647
smart anime poster
>>
>>61770608
>>>/global/rules/6
>>
>>61770647
IT'S NOT A FROG IT'S MOTHERFUCKING FOOD HELP HELPER YOU DENSE ASSHOLR
>>
>>61770307
>>61770337
Why not just use C and realloc?
>>
>>61770680
>>>/b/
>>
I'm moveing form C++ to javaScript because money.
In my shame I'd like to put in a bit of practice, would anybody be kind enough to post the current /g/ roulette/programing challenge
>>
Fins BTFO
>>
>>61770693
just google "g programming chalenges"
>>
>>61770704
>just google "g programming chalenges"
Never crossed my mind...
nice. Thanks for the help anon
>>
>>61770761
>>>/global/rules/6
>>
ok kid
>>
File: 601.jpg (6KB, 165x115px) Image search: [Google]
601.jpg
6KB, 165x115px
>>61770772
Food help helper does not violate global 6 so your pic is unrelated
Pic related: me on my way to scrutinize your flawed rhetoric
>>
I said this already. The C++ faggot is mentally disabled
>>
Are we being raided?
>>
File: 1499223778026.png (402KB, 800x1400px) Image search: [Google]
1499223778026.png
402KB, 800x1400px
>>61770803
>>61770840
>>
Is OpenAL the way to go if I want to write a simple audio system?
>>
new Thread();
>>
>>61770950
>>61770973
>>
>>61770973
>>61770973
>>61770973
>>
File: algo.jpg (30KB, 361x499px) Image search: [Google]
algo.jpg
30KB, 361x499px
>>61763350
i've already studied programming superficially, few languages, now I want to actually seriously learn C. thing is I am a bit of a brainlet, is it a good idea to start at pic related and then move to a C book? if so, which? (heard that K&R might not be the best for beginners)
Thread posts: 353
Thread images: 48


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