[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: 328
Thread images: 51

File: anon joins the programming club.jpg (372KB, 1280x720px) Image search: [Google]
anon joins the programming club.jpg
372KB, 1280x720px
old thread: >>60882065

What are you working on, /g/?
>>
>>60886597
In the face of recent changes in Firefox, some anons were asking for a /g/'s perfect web browser, we have collected here the most wanted features:

Granular control over incomming traffic like Policeman (more control than uMatrix in this particular subject).
Granular control over outgoing traffic like Tamper Data or like Privacy Settings (the addon).
Easy switch to preset profiles for both like uBlock Origin for incomming traffic and Privacy Settings for outgoing traffic.
Random presets generator for things like "user-agent" and "canvas fingerprint".
Custom stylesheets like Stylish.
Userscript support like Greasemonkey.
Cookie management like Cookie Monster.
HTTPS with HTTP fallback and ports management like Smart HTTPS and HTTPS by default.
Proxy management like FoxyProxy.
"Open with" feature to use an external application, like for using a video player with youtube-dl and MPV, or for text input with a text editor, and for other protocols like ftp and gopher, and even as a file picker.
Local cache like Decentraleyes and Load from Cache.
All this in a per site basis.
URL Deobfuscation like "Google search link fix" and "Pure URL".
URI leak prevention like "No Resource URI Leak" and plugin enumeration prevention by returning "undefined".
Keyboard driven with dwb features like vi-like shortcuts, keyboard hints, quickmarks, custom commands and non-bloated smooth UI.
Configuration options from an integrated command-line or in configuration files like Lynx.
A way to import bookmarks from other browsers like Firefox.
Search customization like surfraw, dwb funtions or InstantFox Quick Search, and reverse image search like Google Reverse Image Search.
Writen in C.
Low on dependencies.
Framebuffer support like NetSurf for working in the virtual terminal (TTY).
Actual javascript support so we can lurk and post in 4chan.

Any devs up to the task and join a team?
>>
(println (join " " (take n (reverse arr))))
>>
File: homercar.jpg (93KB, 640x478px) Image search: [Google]
homercar.jpg
93KB, 640x478px
>>60886618
>/g/'s perfect web browser
>>
>>60886618

One more thing...

TREE
STYLE
TABS
>>
>>60886663
>trees
>not generalized hypergraphs

one job
>>
File: 1480277627529.png (530KB, 618x968px) Image search: [Google]
1480277627529.png
530KB, 618x968px
>>60886618
>>
Yesterday's thread got me thinking about calloc. If you set size to 1 byte, does that mean you can only store a range of numbers -128 to 127?

I'm still in school, so definitely wet behind the ears in programming, sorry if this is a faget question.
>>
File: heh21.png (248KB, 340x523px) Image search: [Google]
heh21.png
248KB, 340x523px
What's your opinion on people who call themselves "programmers" and cannot write anything non-trivial without copying it from stack overflow?

>>60886529
>>
>>60886726
Are you calling us all idiots?
>>
>>60886765
Literal code monkey
>>
>>60886661
>expose C API and support module loading.
>come with buildin interface for allowing js by host, the default would be no js.
Minimal you dumb fuck.
>>
File: thisKJFJA.png (39KB, 392x200px) Image search: [Google]
thisKJFJA.png
39KB, 392x200px
>>60886785
>>
>>60886764
You can store 256 distinct values.
What those values mean is up to you.
>>
File: 1451625411521.jpg (31KB, 638x540px) Image search: [Google]
1451625411521.jpg
31KB, 638x540px
>>60886765
The human brain is capable of many illusions.
>>
>>60886801

Oh I understand. The array size would be limited to 256, not the range of the values stored. Thanks
>>
>>60886828
No, they're unital values.
>>
File: 1496809188383.jpg (45KB, 577x622px) Image search: [Google]
1496809188383.jpg
45KB, 577x622px
>>60886597
Can masturbating a lot hinder my programming abilities?
>>
>>60886855
Yes.
>>
File: screenshot.png (393KB, 960x1046px) Image search: [Google]
screenshot.png
393KB, 960x1046px
>>60886597
>What are you working on, /g/?
Making an image viewer from scratch in C with OpenGL. I've successfully rendered a baboon although it's rotated 90 degrees.
>>
>>60886855
Only if you masturbate to niggers.
>>
>>60886855
You don't experience lethargy and brain fog after a fap session?
>>
>>60886765

i like stackoverflow and use it for reference. I don't copy and paste from it though
>>
>>60886764
how would you do the function call?
>>
>>60886889
It's usually the opposite. I can't focus if I haven't jerked off in a while.
>>
>>60886765

A CS degree is supposed to prepare you to be able to solve new problems, and not become paralyzed when you cannot simply copy it off of Stack Overflow. I am going to have to be creative with my assignments when I become a professor.
>>
File: 1496687544036.png (663KB, 1200x776px) Image search: [Google]
1496687544036.png
663KB, 1200x776px
>>60886909

>he fell for the nofap meme
>>
>>60886855
Yes. Masturbation can easily make the time you have available for doing useful stuff disappear.
>>
>>60886919
Who are you quoting?
>>
>>60886919
>rationalizing your pornography addiction on an international cupcake baking conference forum
>>
>>60886892

Stack Overflow is also great for theoretical/technical questions, it can be faster than looking it up in a textbook and I trust the answers there more than random people on Discord or IRC. For example I asked "are string literals stored on the stack or heap?" once on a Discord and I got the totally wrong answer (they said the stack), but I checked Stack Exchange and got the right answer (string literals are treated as static variables, and static variables are usually stored on the data segment).
>>
>>60886934
It doesn't usually take long.
>>
>>60886977
>Discord
That's your problem.
>>
Is there risk of some kind of memory leak in C++14 with this?
while( reader.read_row( ... ) {
std::vector<std::string> strs;
Date dt( ... );
...
}
>>
>>60886726

>Gentoo/Arch Switch

Oh my...
>>
>>60886984
Then either you have no stamina, or you are blueballing yourself.
>>
why does this script save a blank image, but shows the correctly filtered image?
from PIL import Image, ImageFilter
import sys

fn = sys.argv[1]
try:
newfn = sys.argv[2]
except:
newfn = "output.png"

k = ImageFilter.Kernel((3,3), [-1,0,1,
-2,0,2,
-1,0,1])

im = Image.open(fn)
im = im.filter(k)
im.show()
im.save(newfn)
>>
>>60887040

No, but you will end up doing lots of allocation and deallocation if you put the vector in the loop.
>>
Some simple AI project made with Scheme.
>>
>>60887040

In what context?
>>
From stackoverflow:
int logical_shift_right(int x, int n)
{
return (int)((unsigned int)x >> n);
}


It seems like an elegant solution, and it works, but I'm not sure I understand it.

If you right shift on an unsigned type in C, the bits shifted in will be zero regardless of the MSB? Is this true on any machine or compiler?
>>
>>60887091
>>60887103
Reading data in from CSV
>>
>>60887092
What's the AI doing?
>>
>>60887123

That's kind of the idea. On an unsigned type, an arithmetic shift and a logical shift are the same thing.
>>
>>60887141
>On an unsigned type, an arithmetic shift and a logical shift are the same thing.

Is this defined by the language or dependent on the compiler?
>>
>>60887158

I don't think it's formally defined anywhere, just that it works out that way in practice.
>>
>>60887123

>Is this true on any machine or compiler?
Should be, but if you have doubts, test it!

https://gcc.godbolt.org/
>>
Recommend me a portable IDE for C++, thx
>>
>>60887075
i found this works on some images but not on others. anyone know why it could be?
>>
>>60887129

Play Final Fantasy Tactics.
>>
>>60887244
https://www.jetbrains.com/clion/
>>
>>60887274
That sounds like a fun project.
>>
My programmers always get stuck debugging things because they don't follow the flow of data.
Can anyone recommend a good article on what the thought process should be during debugging?
>>
File: 8Qm40AF.jpg (94KB, 663x710px) Image search: [Google]
8Qm40AF.jpg
94KB, 663x710px
>>60887288
https://www.wikiwand.com/en/Rubber_duck_debugging
>>
>>60886855
Not if you masturbate to anime girls (female).
>>
>>60887298
why the fuck would you link a proprietary interface to an open source website
>>
>>60886934
Because being constantly distracted while horny is better, right?
>>
>>60886873

Do you have loops nested correctly?
>>
>>60887040
No, but there's a certain risk of syntax error.
>>
>>60887332
lel, if it is such a problem for you, maybe you should take the medication that they give to the pedophiles to stop them being horny.
>>
>>60887356

>take pills

Or you could just jerk off
>>
>>60887356
What's wrong with being horny?
It's completely natural you retard, and there's nothing wrong with relieving it.

Nofapfags are retarded.
>>
>>60886855
Yes. But being horny all the time is not helpful as well. I managed to convince myself that solving programming problems gets me closer to pussies, so far it works and make me sex like a wild animal in the end of the week.
>>
>>60886873
>baboon
good choice

Lenna would've worked too
>>
I need a hint, pls. I don't know how to do this without using conditionals and loops:
/*
* bitCount - returns count of number of 1's in word
* Examples: bitCount(5) = 2, bitCount(7) = 3
* Legal ops: ! ~ & ^ | + << >>
* Max ops: 40
* Rating: 4
*/
int bitCount(int x) { // Not sure how to make this not iterative...
(unsigned) x;
int sum = 0;
for (int i = 0; i < 32; ++i)
{
sum += x & 1;
x >>= 1;
}

return sum;
}
>>
>>60887437
http://www.felixcloutier.com/x86/POPCNT.html
>>
>>60887386
>natural
>implying natural is good
>>
>>60887437

does it have to be without loops? Your compiler will probably unroll it if it's faster that way
>>
>>60887459
I guess you just hate fun then.
Or maybe you have problems, because fapping doesn't affect my ability to program.
>>
>>60887437
Nevermind efficiency, you're invoking UB.
>>
When I make
free(ptr);


how does free() know how much memory to free?
>>
File: whatthe.jpg (6KB, 217x213px) Image search: [Google]
whatthe.jpg
6KB, 217x213px
im running a command to copy a csv file and rename it. It works....kind of. The file is there but it's a blank csv file

what went wrong?
>>
>>60887501
There is a header stored directly before the returned memory storing some information such as size.
>>
>>60887343
There's no nested loops and I know why it's rotated, I just haven't bothered to fix it yet. It's a PGM image which is plain text and the pixels are laid out in such a way that it's not oriented correctly if you read them row by row. This was just to make sure I have OpenGL working correctly and understand texture data before I move on to more complex image types.
>>
>>60887501

Your malloc implementation takes care of that. It'll keep a record of all the blocks of memory which have been allocated.
>>
>>60887386
he said "being __constantly__ distracted while horny is better"
>>
>>60886618
Better pack telemetry into it and make it closed source so no one knows. That way we can spy on any channer who uses it and make fun of them for what porn they watch.
>>
http://104.200.138.151:8080/

I'm working on this, wasd to move, mouse to point and shoot.

The backend is written is C.
>>
>>60887585
>http://104.200.138.151:8080/
requires javascript, though.
>>
>>60887585
>backend in c
the absolute madman
>>
>>60887621
yeah, the front end is JS unfortunately.
>>
What does echo actually do to print stuff to the terminal?

I'm going to make a script which strips off an option and passes the arguments onto a subfunction. Literally a setup program which calls other scripts, but can do so by specifying a number, this way I can keep all my references in one location, and just call that one script and a number.

Using bash, it utterly fucks up spaces and stuff, but it's pretty simple to substitute proper things. i.e:

IN="'"
IN+=${IN//\'/\'\"\'\"\'}
IN="'"

replaces something like abc'def with abc'|"|'|"|'def (emphasis mine), which lets me get through at least one layer of parsing.

I can verify this is the result by setting -x in the script. I can run an echo $IN at the end and it shows the expected output abc'123

HOWEVER if I run it in a command substation i.e. OUT=(echo $IN), it gives me back exactly the string I put in - literally not the same output it gives during normal command exit. Similarly, if I pipe the output from the existing echo (which prints on terminal as expected) I get the same overly formatted output. The echo literally isn't processing the commands unless the output goes to terminal, so I can only assume it's terminal fucking with my output.

Printf shits itself too.
>>
>>60887437
Not generic enough.

#include <stdio.h>
#include <stdint.h>
#include <type_traits>

template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
int bitcount(T x) {
int n = 0;

for (unsigned i = 0; i < sizeof(T) * 8; i++) {
if (x & (static_cast<T>(1) << i)) {
n += 1;
}
}

return n;
}

int main() {
printf("%i\n", bitcount(5));
printf("%i\n", bitcount(7));
printf("%i\n", bitcount<uint8_t>(0xff));
printf("%i\n", bitcount<uint64_t>(0xffffffffffffffff));
printf("%i\n", bitcount('A'));
printf("%i\n", bitcount(true)); // apparently bool is integral, lol
//printf("%i\n", bitcount(5.8)); // error
}
>>
A language like PHP should not have an eval function
>>
>>60887763
That won't work, you need a space between ::value> and >
>>
>>60887784
Compiles fine in GCC.
>>
>>60887764

>A scripting language should not have eval
uhh
>>
>>60886618
hahaha, do you have the logo yet? :^)
>>
>>60887763
constexpr edition:

#include <stdio.h>
#include <stdint.h>
#include <type_traits>

template <typename T, typename = std::enable_if_t<std::is_integral<T>::value>>
constexpr int bitcount(T x) {
int n = 0;

for (unsigned i = 0; i < sizeof(T) * 8; i++) {
if (x & (static_cast<T>(1) << i)) {
n += 1;
}
}

return n;
}

int main() {
printf("%i\n", bitcount(5));
printf("%i\n", bitcount(7));
printf("%i\n", bitcount<uint8_t>(0xff));
printf("%i\n", bitcount<uint64_t>(0xffffffffffffffff));
printf("%i\n", bitcount('A'));
printf("%i\n", bitcount(true)); // apparently bool is integral, lol
//printf("%i\n", bitcount(5.8)); // error
}
>>
File: hlSATDY.png (61KB, 324x342px) Image search: [Google]
hlSATDY.png
61KB, 324x342px
Rate my icon, /dpt/
>>
>>60886873
>Making an image viewer from scratch in C with OpenGL.
kek
>>
>>60887703
>OUT=(echo $IN)
Don't you mean
OUT=$(echo $IN)
?
>>
>>60887840
Not just any scripting language. A scripting language specifically designed for authoring scripts to be invoked remotely with limited file i/o permissions by total strangers. It's a bad idea to include eval in a language like that, because noobs might be encouraged to use it in ways that could open their system to attack.
>>
>>60887437
int bitCount(int x) {
x = x - ((x >> 1) & 0x55555555);
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
return ((x + (x >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
>>
>>60887784
You do not. It has been fixed in C++ standard.
>>
>>60887937
This is pretty wild, good job.
One of the other constraints, though, is no use of a constant greater than 0xFF.
>>
>>60887889
>not procedurally generated
0/10
>>
File: heh.png (50KB, 200x216px) Image search: [Google]
heh.png
50KB, 200x216px
>he uses tabs not spaces
>>
>>60888060
>He doesn't indent with tabs and align with spaces
>>
>>60888060
>not both
uhh weeb brainlets?
>>
>>60888124
>>60888165
>mixing tabs and spaces
>>
>>60888186
Next thing you'll tell me you don't use
void function()
{
while (true) {

}
}

style braces.
>>
>>60887916
There's a bunch of typos in the post. I assure you I have tried that, quoting, and a million other things. I have 3-4 lines of echo and printf in my script just to see if any manner of variable or command substitution works.
>>
>>60888198
>function(
>while (
dumb nigger
>>
>>60888251

do you call functons like
function ()
? You disgust me.
>>
>>60888265
>thingWHITE_FUCKING_SPACE(
>instead of superior thing(
>>
File: 1486594542834.jpg (12KB, 261x210px) Image search: [Google]
1486594542834.jpg
12KB, 261x210px
Do you ever feel like you're coding yourself into a hole, and the more you try to fix it the more you fuck up; at the end of the day you end up having to scrap everything and you feel exhausted?
>>
>want to try out emacs
>no MOD/META key
>can't use ALT because i3wm
what do I do
>>
>>60888452
map caps lock as left control
map left control as MOD/META
>>
>>60888244
I fail to understand want you need. If you want the variable "$OUT" to equal "$IN", why not just assign it? There is no need to use command substitution, because "OUT=$(echo $IN)" is identical to "OUT=$IN"
>>
>>60888452
install evil mode
>>
>>60888410
Absolutely. I used to do that all the time. No I carefully plan everything. I try to explain everything using theory so it's easier to understand and optimize later. Perhaps I spend way too much time on it...

Currently, I'm trying to write something like the Luigi library in Python, but smaller scale, for my data analysis program. I know that means more initial time consumed, but it will be more flexible and readable later on.
>>
So I understand how to use regular expressions to do something like, findeverything within a set of brackets, but I don't know how to exclude the brackets itself.

Like say I have [dickbutt] and I just wanna match the words dickbutt if they're in brackets, but I don't want the match to include the brackets. Can someone give me an example of that?
>>
anyone know why this command isnt working? im stuck

C:\PROGRA~1\PHP\v7.1\php.exe -f "C:\SQLite3\replacements\importTrackingData.php"
>>
So, let's say you're coding a game in C, and you want to start making data and behaviors for each type of game actor.

How would you do it?

I'm just using lua, but I know there's a lot of possible approaches. Could just write out data and behavior in plain C, for example.
>>
Favorite programming books? Mine are:
>C
C Programming: A Modern Approach (KN King)
and then
Understanding and Using C Pointers (O'Reilly)
>Assembly
Programming from the Ground Up (Bartlett)
>Java
Core Java vols 1 and 2 (as a reference if you know some Java and general programming; not for beginners)

>Python
Haven't really found a 10/10 Python book yet to be honest.
>>
i'm watching bisqwit's videos on parallelism

i feel like such a fucking brainlet
>>
File: 1351060799515.jpg (60KB, 500x600px) Image search: [Google]
1351060799515.jpg
60KB, 500x600px
>>60886618
>Writen in C.
Good
>>
>>60888981
>C
>A Modern Approach
*thinking*
>>
>>60889000
Most of it is incredibly contrived, you could just write a bash script to do that.
>>
>>60887123

So I learned logical shifts, MSB, etc. in Hardware class in my degree, but I have no idea where it would be applicable in the real world. Where would you use this?
>>
>>60888981
>no algorithm book
senpai
>>
>>60889087

Logical shifts make for efficient multiplication by constants of powers of two. I guess.
>>
>>60888978
You write functions for each possible game actor, then in your game loop, loop through all your actors, and do something like if actor.type==badguy then badGuyFunction()
>>
>>60889208
>anti-OOPfags will defend this
>>
>>60886774
No, just autists who like bad things.
>>
>>60889218
If you wanna be a bitch about it use function pointers and attach them to your actor
>>
>>60889285

Inefficient as fuck, handrolled OOP is cancer.
>>
>>60889304
I didn't claim to be an expect, I just know it works
>>
>>60889192
Not useful as compilers already make those optimizations.
>>
>>60889227
rude
>>
>>60889227
You are welcome to leave.
>>
>>60889317

So, would be useful on small scale IoT code that doesn't have those optimizations?
>>
I am so goddamn sick of non-programmers who write what's in front of them. It's like every programmer I work with makes my job harder until I can't do anything but clean up after them and hold their hand.
>>
>>60886934
4chan makes the rest of it disappear.
>>
>>60887763
>>60887880
#include <stdio.h>
#include <numeric>

namespace bit_count_detail
{
template<uint8_t... V>
struct list;

template<typename, typename, typename, typename>
struct cat;

template<uint8_t... V0, uint8_t... V1, uint8_t... V2, uint8_t... V3>
struct cat<list<V0...>, list<V1...>, list<V2...>, list<V3...>>
{
using value = list<V0..., V1..., V2..., V3...>;
};

template<typename>
struct unpack;

template<uint8_t... V>
struct unpack<list<V...>>
{
static constexpr uint8_t value[] = { V... };
};

template<uint8_t... V>
constexpr uint8_t unpack<list<V...>>::value[];

template<template<uint8_t> class T, uint8_t V>
struct fold
{
using value = typename cat<
typename T<V>::value, typename T<V + 1>::value, typename T<V + 1>::value, typename T<V + 2>::value
>::value;
};

template<uint8_t V>
struct b2
{
using value = list<V, V + 1, V + 1, V + 2>;
};

template<uint8_t V>
using b4 = fold<b2, V>;

template<uint8_t V>
using b6 = fold<b4, V>;

using bit_count_table = unpack<typename fold<b6, 0>::value>;
}

template<typename T>
constexpr int bit_count(const T &x)
{
const uint8_t *p = reinterpret_cast<const uint8_t *>(&x);
return std::accumulate(
p, p + sizeof(T), 0,
[](int n, uint8_t b)
{
return n + bit_count_detail::bit_count_table::value[b];
}
);
}

int main(void)
{
struct
{
int _0, _1;
uint8_t _2;
char _pad1[3]; // we need these because
uint64_t _3;
char _4;
bool _5;
char _pad2[2]; // uninitialized stack
double _6;
} foo = {
5, 7, 0xff, { 0 }, 0xffffffffffffffff, 'A', true, { 0 }, 5.8
};
printf("%i\n", bit_count(foo._0));
printf("%i\n", bit_count(foo._1));
printf("%i\n", bit_count(foo._2));
printf("%i\n", bit_count(foo._3));
printf("%i\n", bit_count(foo._4));
printf("%i\n", bit_count(foo._5));
printf("%i\n", bit_count(foo._6)); // 0x4017333333333333
printf("%i\n", bit_count(foo));
}
>>
>tfw to tired to work
>tfw to awake to sleep
>>
I just wrote a simple 4chan image downloader using python. Would it hurt to put it on my github?

I'm just thinking about future employers not liking 4chan considering the stigma around it.
>>
>>60889208
>not even a case/switch

>>60889285
>>60889304
Function pointer struct members are optimized down lmao. What year do you think this is? They are cancer for like, polymorphism and such tho.
>>
File: dlang_chan.jpg (70KB, 349x368px) Image search: [Google]
dlang_chan.jpg
70KB, 349x368px
Threadly reminder that dlang-chan has RAII; she's quite fast in execution and compilation; she's becoming fully memory-safe; and she's super duper cute! Say something nice about her, /dpt/!

>Tour
http://tour.dlang.org/
>Books
https://wiki.dlang.org/Books
>GC
https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/
https://wiki.dlang.org/Libraries_and_Frameworks#Alternative_standard_libraries_.2F_runtimes
>>
>>60887437
int bitcount(int x)
{
int sum = x & 1;
x >>= 1;

if (x)
{
sum += bitcount(x);
}

return sum;
}
>>
>>60889556

Just get rid of any direct references to 4chan and say it's for use on BBSes or image boards or something.
>>
>>60889605
Stop. D shills are the cancer of this thread.

If you really want to encourage people to use D, stop copypasting and instead post relevant replies involving D.
>>
>>60887905
What's so funny?
>>
C++ or Rust for new projects? Specifically, game progrmaming
>>
>>60888723
>C:\PROGRA~1\
Uh, what year is it again?
>>
>>60889720
That's like the very first D shilling post in this thread. Needless complaining is worse than shilling.

>>60889754
C++ is much more established as a gamedev language. Make of that what you will.
>>
>>60889637
>>60887437
>without using conditionals

Didn't catch this at first. Is it allowed to create a second function?

int nop(int x)
{
return x;
}

int bitcount(int x)
{
int (*f[2])(int);
f[0] = nop;
f[1] = bitcount;

int sum = x & 1;
x >>= 1;

return sum + f[!!x](x);
}
>>
What's the best way to learn modern C++? My experience is mostly with C and Haskell. I haven't the faintest idea what a copy constructor is.
>>
https://www.youtube.com/watch?v=KZjFVdU8VLI

I've never used clojure before, but I just tried it for android development, and figwheel was part of the setup. Mind blown. Does anything like figwheel exist for other languages? In particular haskell?
>>
>>60889799
I learned C++ by reading Effective C++ and More Effective C++ by Scott Meyers. There's also a book called Effective Modern C++.

Those books assume you know some bare minimum of C++, but unless you are a complete tool, you will manage.
>>
>>60889822
Thanks, I'll check them out.

I do have a small amount of C++ experience from about 10 years ago but I figure it's pretty much useless now.
>>
File: snailgf.jpg (41KB, 793x631px) Image search: [Google]
snailgf.jpg
41KB, 793x631px
I thought of a new way asian m00t could squeeze more shekels out of this God forsaken place.

The going rate for captcha solving services is about $1.00 for 1000 captchas and there must be hundreds of thousands of captchas solved everyday here. All you have to do is become a worker for one of these services and forward the captchas to the browsers of the posters here.

Shitposters are basically an untapped free labor source.
>>
>>60888494
Reread what I'm doing, then read it again, then read it again.

If I run echo $IN, I get different results than $(echo $IN). That should literally not be happening. Worse, I can do echo $IN and pipe it, and it still doesn't work. I can directly call echo on the terminal with the contents of $IN and it prints properly, but I pipe it and it doesn't pipe the same result.

I haven't tried directly piping the output to stdout and then piping again.
>>
>>60889799
>>60889837

Modern C++ looks totally different to C++98. It's all about RAII and smart pointers and shit. Basically you want to write C, but also use scoped lifetime and maybe some templated datastructures.

As for a copy ctor...
Foo a;
Foo b = a; // what does it mean to copy a onto b?
>>
>>60889799
A copy constructor is an OOP thing, it's a thing in pretty much every OOP language. It's a constructor (assuming you know what that is) that takes an object of the same type as an argument, and constructs the new object functionally identical to the first, copying all the data from the original object.
>>
>>60889882
It... copies the struct field-by-field?
>>
>>60886912
>I am going to have to be creative with my assignments when I become a professor.
First semester compsci here, we had to make a simple digit recognition program (like the old warped captchas) and make a bot that traded in a simple virtual world. Fun shit, but addictive, and also insanely hard for the noobs.
>>
>>60889896

>it's a thing in pretty much every OOP language.
it's pretty much exclusive to C++, Java and the ilk prefer clone methods. Which you'll also want to do in C++ if you're using polymorphism, by the way.
>>60889899

That's the obvious thing to do, and that's the copy constructor the compiler will automatically generate for you if you don't specify one.
If you're making a class that models a resource like a unique resource like a file, then you'll want to delete the copy constructor. Or perhaps your class is a dynamic array that contains a pointer somewhere on the heap and you want your copy constructor to perform a deep copy to a new array rather than a shallow copy of the pointer. You could put that logic in your copy ctor.
As of C++11 there are also move constructors, but that can wait.
>>
>>60889953
I... see. I have much to learn. Thanks anon
>>
Does anyone know why my variable names might be invisible in PowerShell? For example, typing "$null" immediately makes the text invisible after typing more than the "$"
>>
>>60886726
Other than the Arch/Gentoo switch (fuck Arch), sign me up
>>
>>60889953
>overloading equals
This is what's wrong with society
>>
>>60889869
I read it, I still don't understand. So suppose I shouldn't be replying and wasting your time, but I simply fail to understand the immediate problem.
>If I run echo $IN, I get different results than $(echo $IN)
I don't understand what you mean:
$ FOO='test'
$ echo $(echo $FOO)
test
$ echo $FOO
test
$ BAR="$(echo $FOO)"
$ echo $BAR
test
>>
>>60890123

Overloading equals (copy assignment) is different but related to copy construction.
It serves an important purpose actually, otherwise you might have memory leaks.
class DynArray
{
private:
size_t size;
char* data;
public:
DynArray(size_t _size):
size(_size), data(new char[_size])
{ };
DynArray& operator=(const DynArray& other)
{
delete[] data;
size = other.size;
data = new char[size];
memcpy(data, other.data, size);
};
};

DynArray foo(3);
DynArray bar(4);
foo = bar; // If we didn't overload =, memory would have been leaked since we didn't delete the old data ptr


Copy assignment usually combines destructor (free memory that will no longer be needed) and copy constructor (make copies of the other object's data, allocating memory where needed) logic into one.
>>
>>60890246
Why not just:
DynArray &operator(const DynArray &other)
{
this->data = other.data;
return *this;
}


Instead of reallocating the data? Then have the destructor free it.
>>
>>60890288

DynArray* foo = new DynArray;
DynArray* bar = new DynArray;
foo = bar;
// foo.data == bar.data
delete foo;
// bar.data now points to freed memory

Besides that, the general aim is to provide encapsulation. Client code should not care about the workings of DynArray under the hood, and behavior such as
Object foo;
Object bar;
foo.mutate();
// bar should be unchanged

should be avoided. So each object owning its heap pointer is ideal.
>>
File: 1430872326149.jpg (62KB, 413x423px) Image search: [Google]
1430872326149.jpg
62KB, 413x423px
/dpt/ I have only ever worked alone on personal projects. I tend to write things as needed until my program does what I need it to, then I read over the whole project and try to refactor it to do the same thing but with more sane code and with actual error handling.

Is this pattern normal when starting a project from scratch? I've been doing it for a long time now and I kind of thought I'd get to a place where I'd be writing a pretty good implementation on the first pass instead of coming up with a better way to implement what I just wrote. I end up rewriting a large portion of my projects every time I create one, the initial implementation is always a terrible mess that would never be maintainable and is filled with cruft.

Are there any resources that would help me in a quest for better initial designs? Is such a thing possible or does everyone just write garbage then refine it for release?
>>
>>60890386
First determine what you want, then determine what features you want, then determine how you can make this work incase you want to add more shit later.

Then you can start writing code.
>>
>>60889939
That sounds like fun, how can I get excited about programming(aside from looking at cute knee-high socks)
>>
>>60889939
Huh, I've been helping a friend of a friend on those projects, they must be in your class. Neat!
>>
>>60887255
File type
>>
>>60890212
>my post
>your head
REREAD IT AGAIN HOLY FUCK. I explicitly said what I'm putting in, and what I want it to do. To make it easier for you to understand, here's an example of how it should be:
#!/bin/bash

<code that asks for a selection and arguments>

<wrap arguments>

${DIR}/setup/allmysubfunctions $SELECT $OUT



#!/bin/bash

SELECTION=$1
ARGS=$2

ARGS=stripquotes ARGS

<selector>

subfunction $ARGS

>>
>>60887763
Why would it even have to be integral?
>>
>>60887763
>generic
What is an ``generic" though?
>>
>>60887764
PHP is T*ring-complete, so it will always have an eval function.
>>
>>60890288
The aim of the copy-assignment operator is to provide an independent copy of the object, so if the other object is freed then the current instance should be unaffected.

This is actually what might happen in a valid move-assignment operator:
array& operator= (array&& other) { 
delete[] data;
this->data = other.data;
other.data = nullptr;
return *this;
}
>>
>>60890578
A program construct that is able to handle data of multiple types.
>>
>>60890386
>first paragraph
This is how it should be done anon. I'm happy it comes naturally to you.
People nowadays view their first iteration as too precious (I blame oop, oop is not flexible so it doesn't make sense to iterate). Realistically planning breaks down. So you shouldn't hold your iterations as precious but rather the course grain design of what you're writing.

The only situation where you can effectively plan out ahead of time is when solving old problems and you have the experience of others doing the exploration. There you get systems like recursive decent parsers or whatever.

To improve your initial design you could plan. I question how viable that is though. Some amount of planning will probably help because it means you've considered a few things early on. But you shouldn't plan so much that you get attached to this idea of your program. Reality should guide you more than your plan.

It's different in teams. If you have control of a sub-system and you don't need to establish an api immediately then you can do the same thing. In other cases your ability to explore is compromised to some degree. It may be tough to judge how. But a bad plan (as plans usually are when you're traveling uncharted waters) will hurt you long term. And if you have Legacy code relying on your planned code that's worse than slight stalls due to exploration.

>write garbage and refactor at release
There's a skill to this. You need to identify the critical components of your system. You shouldn't be stacking garbage when it's obvious that things are garbage. You can't make good decisions if you're working on top of a large garbage pile. So you need to see the limitations. Things like how much information needs to be passed down into subroutines is a good metric of doing something wrong. It reduces code malleability drastically. Almost all the basic ideas of writing good programs apply just more loosely because you're aiming to clean up.
>>
DAE hate when you're hung up on what turns out to be a simple mistake?
ELI5 how to deal with the frustration.
>>
>>60890953
>DAE
>ELI5
???
>>
Any youtubers/vlogs worth following as a newbie programmer? I feel I could always learn from more experienced programmers, besides doing exercises and stuff. [spoiler] Also, I don't have any friends, so I don't have anyone to learn from ;_; [/spoiler]
>>
>>60890967
I believe that's what they call "leet speak".
>>
I want to make a program that automatically keeps track of my life.


As in times how long i do certain things and adds all of it up.


Which language should i use or should i just get ubuntu and use the excel program on there?
>>
>>60891045
Hmm. I've heard of leet speak. But I don't get what elis is implying. Guess the post just isn't for me.

I don't like how exclusive this girls club is.
>>
>>60889080
>writing a bash script to watch videos for you
Do you also write scripts to eat your food for you so that you may comfortably starve?
>>
>>60891258
That post looks like it was written by some reddit kid. You should be happy that you don't understand it.
>>
File: 1494994085388.jpg (100KB, 1024x768px) Image search: [Google]
1494994085388.jpg
100KB, 1024x768px
>>60890399
>>60890860
I appreciate the input.
>>
File: 1459266558167.png (177KB, 384x445px) Image search: [Google]
1459266558167.png
177KB, 384x445px
>>60886625
>println
>>
File: fullDesktop.png (1MB, 1680x1050px) Image search: [Google]
fullDesktop.png
1MB, 1680x1050px
>>60886618
>/g/'s perfect browser
>bloated pile of shit with way too much shit only one guy cares about
Fuck you use Metanoia.
>>
>>60889478
Has science gone too far?
>>
Why should I use std::array over a C style array?
>>
>>60889304
>OOP is cancer
I agree.
>>
>>60890967
>dae: does anyone else
>eli5: explain like I'm 5
>>
>>60887313
That's the opposite of what you're supposed to fap to while wearing programming socks.
>>
>>60886855
Chastity cage compliments programming socks very well.
>>
>>60890953
>>60891434
>DAE
>ELI5
Your kind isn't welcome here.
>>>/r/ibbit/
>>
>>60889721
The fact that your idea of "from scratch" includes a huge fucking library which supports rendering images.
>>
>>60891434
>>60890953
ribbit.com
>>
>>60891396
Type safety.
>>
>>60891474
Such as?
>>
>>60888198
>>60888265
>>60888297
>stupid fucks arguing about whitespace when you could be arguing about the fact that he didn't use an optimized tail-call recursive function instead of a while true wrapping everything.
>>
>>60891209
Pls respond
>>
File: 17 - 1 (2).gif (505KB, 1080x1080px) Image search: [Google]
17 - 1 (2).gif
505KB, 1080x1080px
>>60891435
>>60891449
What's a better design pattern for efficient kode: anal with other girl(male)s, or anal with masc straight men who are willing to try it with you anyway because you wear the clothes so well?
Asking for a friend
>>
>>60891452
I feel I'd be better off not knowing that.
>ELI5
Anyone expecting their question to have that kind of answer shouldn't even be asking.
>>
What is the &keyword order in Common Lisp?

My macro has this (x &key (test #'eql) &rest guards)
But it says the &rest is badly placed.
Help
>>
>>60886625
>scheme
>>
>>60889328
As are you.
>>
>>60891500
I think you would need to design the program first before considering the language used to implement it. Your concept is very broad and vague.
>>
>>60891530
To explain something to a 5 year old one must have a truly great understanding of a subject.
Asking someone to eli5 is to seek a thorough and easily digestible answer from a master level *.
>>
>>60891714
we don't do that here
fuck off fagtron
>>
>>60891743
Because no one here knows what they're talking about?
>>
>>60891743
>>60891795
Stay apprentice 4chan.
>>
>>60891515
You have watched too much Boko no Poko.
>>
>(apply #'progn matching)
>progn is a macro
fuck
>>
>>60890953
fuck off leddit
>>
>>60891544
http://clhs.lisp.se/Body/03_dd.htm
>>
>>60891515
>an actual legbutt has stumbled upon the falseflagging lgbt propagandists and mistaken them for genuine
please leave, you're scaring the disturbingly few of us here who aren't mentally ill
>>
Rewriting the Linux kernel in template metaprogramming.
>>
>>60891822
progn isn't a macro.
>>
File: 1460040182913s.jpg (6KB, 225x250px) Image search: [Google]
1460040182913s.jpg
6KB, 225x250px
Building a search engine called wibr.me
It contains hobbyist/educational/personal web pages that aren't bloated with scripts.

Trying to get more pages indexed. Its hard finding pages that aren't bloated piles of crap full of CSS and ads without any useful content to speak of. If you know any good pages, feel free to submit them.
>>
File: 1474506433545.jpg (107KB, 606x1000px) Image search: [Google]
1474506433545.jpg
107KB, 606x1000px
>>60891435
>>60891449
>>60891515
Why is /dpt/ so gay?
Anime girls > anime "girls"
>>
>>60891873
special form then, whatever
still can't treat it like a function
>>
>>60889000
I hate myself after I watch any of his videos
>>
File: 1494309671908.png (183KB, 308x539px) Image search: [Google]
1494309671908.png
183KB, 308x539px
>>60891886
>those chest tumors
>>
>>60891888
Why are you trying to do that? You could just use eval.
>>
>>60891908
Chest mountains > chest flatlands.
Deal with it, low test faggot.
>>
>>60891877
>wibr.me
Will that redirect me to meatspin.com?
>>
File: images (9).jpg (8KB, 228x221px) Image search: [Google]
images (9).jpg
8KB, 228x221px
>C doesn't even have polymorphic function pointers
>>
>>60891951
When you hug a flat-chested girl, she's closer to your heart.
>>
File: 1471189173065.png (68KB, 1200x2400px) Image search: [Google]
1471189173065.png
68KB, 1200x2400px
>>60891951
DFC is for the thinking man.
>>
File: Co72t-EWYAAASEL.jpg (27KB, 447x469px) Image search: [Google]
Co72t-EWYAAASEL.jpg
27KB, 447x469px
>>60891963
>a flat-chested girl (male)
>>
>>60891963
Only marginally.
Costs still outweigh the benefits.

>>60891975
>That image
Kill yourself, seriously.
>>
File: 1b2.png (72KB, 200x222px) Image search: [Google]
1b2.png
72KB, 200x222px
>>60891975
>he is actually a shotapon
>>
>>60891986
It's a girl
>>
File: 798.png (306KB, 593x540px) Image search: [Google]
798.png
306KB, 593x540px
>>60891989
>(male)
>>
>>60891961
Function pointers are polymorphic by nature, you stupid fucking retard.
Unless you're implying that C doesn't have function pointers, in which case you're even more of a stupid fucking retard.

Either way, you're a stupid fucking retard, there's no escape.
>>
This is pretty gay man
>>
>>60891995
Nope, definite female.
>>
I want to learn how to program.

I have a bunch of topics in my head.

Where do I even start?
>>
>>60892009
Learn Lisp.
>>
might be not necessarily programming related, but any of you know how to start chrome such that one window opens on one monitor and one opens on another?
>>
File: tumblr_inline_niiamgxftd1rnnsez.png (117KB, 372x351px) Image search: [Google]
tumblr_inline_niiamgxftd1rnnsez.png
117KB, 372x351px
>>60891998
>Function pointers are polymorphic by nature, you stupid fucking retard.
>he mad because his language literally can't even assign an int(*)(void) to a union {int i; char c;} (*)(void)
>>
>>60892009
>Where do I even start?
Kernel development.
>>
File: 1488504948862.png (56KB, 364x271px) Image search: [Google]
1488504948862.png
56KB, 364x271px
>>60892010
"Lisp" is garbage.
>>
>>60892023
Too bad, learn it.
>>
>>60892023
You're going to learn it and you will love it.
>>
>>60892014
>his language
I use C++, not C. Although I used C for a long time and know more about it than you.

>union {int i; char c;} (*)(void)
That's not even a valid fucking type.
>>
>>60892048
>That's not even a valid fucking type.
It actually is. It's a function pointer that takes nothing and returns a union {int i; char c;}.
>>
>>60892009
Start by wanting to make something and trying to make it. Copy code off google, realize you don't understand how it works, google keywords from the code you copied, learn. Or pick a book or tutorial but I don't think coding tutorials are ever really a good idea.
>>
File: 1460216041968.png (78KB, 416x329px) Image search: [Google]
1460216041968.png
78KB, 416x329px
>>60892036
>>60892044
How can you learn something you already know?
>>
File: 397.jpg (63KB, 447x400px) Image search: [Google]
397.jpg
63KB, 447x400px
>>60892048
>That's not even a valid fucking type.
>he doesn't even know his own language
>>
>>60892069
erase your brain and relearn it
>>
>>60892060
Oh okay, but what's your point? Why would you even want to assign an int(*)(void) to it?
Also, you can, if you cast it.

I don't think you really know what polymorphism is.
>>
>>60892048
What constitutes a "valid" type? How can you tell?
>>
>>60892079
>How can you tell?
If it compiles it's valid
>>
File: dragon loli.jpg (107KB, 1280x720px) Image search: [Google]
dragon loli.jpg
107KB, 1280x720px
In C, can you make a truly generic function pointer that can return any type and take any amount of arguments or none at all?

You can achieve the latter by omitting the argument list, but I haven't found a way around the former.
>>
How do you get better at algorithmic thinking?

Any algorithm type code I wrote ends up as terrible brute force functions. I've been doing HackerRank and I keep getting timeout errors when submitting code because my code is so shit.
>>
>>60892072
>He can't read
C isn't my language.

And my point still stands.
Function pointers are polymorphic, and whatever retarded shit he's talking about is completely irrelevant.
>>
>>60892090
learn dynamic programming
>>
>>60892081
How can you be sure?
>>
>>60892060
Works with GCC.
>>
>>60892088
Have you tried killing yourself?
>>
File: 1460426390082.jpg (107KB, 662x570px) Image search: [Google]
1460426390082.jpg
107KB, 662x570px
>>60892088
>generic
What is an "generic" though?
>>
>>60892109
rude
>>
>>60892078
>Oh okay, but what's your point? Why would you even want to assign an int(*)(void) to it?
Assigning a function that returns an atomic type to a variable that can hold a function that returns a union type of which that atomic type is a member could be useful if what type you return needs to depend on what implementation you're supplying. Another use case would be polymorphism over the parameters rather than over the return type, to achieve something like overloading.
>Also, you can, if you cast it.
Undefined behaviour. The cast itself isn't, but try to call the result and you may well end up with a nasty crash.
>>
>>60892115
It's a fucking kill yourself.
>>
>>60892088
I mean you can choose one function pointer signature to be "generic" and use that for passing functions around, but for it to do anything useful you have to call the actual function with the right signature.
>>
>>60892120
stop being rude, anon
>>
>>60892088
void*(*)()
>>
>>60892128
No.
Jump of a bridge.
>>
File: 14715296417416.png (134KB, 500x500px) Image search: [Google]
14715296417416.png
134KB, 500x500px
>>60892120
>>60892132
That's a rude thing to say, anon
>>
>>60892132
being rude is wrong, anon
>>
>>60892122
You can simulate function overloading when necessary by using empty list function pointers.
>>
>>60892137
I know.
Hopefully you'll heed my advice and jump of a bridge and kill yourself as soon as possible.

>>60892138
Put a bullet through your head.

>>60892131
>void*
>*
Slit your wrists immediately.
>>
File: 1480184903617.png (142KB, 686x441px) Image search: [Google]
1480184903617.png
142KB, 686x441px
>>60892147
In what sense?
>>
>>60892160
In the sense that you should end your pathetic life, of course.
>>
There are some very rude and unpleasent people in this general, shame on you.
>>
>>60892088
>can you
We don't need to
>>
File: 1487724112951.gif (2MB, 500x500px) Image search: [Google]
1487724112951.gif
2MB, 500x500px
>>60892213
They need more Akari in their lives.
>>
File: 1458230861705.jpg (72KB, 459x483px) Image search: [Google]
1458230861705.jpg
72KB, 459x483px
>>60892170
I'm not sure anyone wants that.
>>
>>60892104
I'm not sure.
>>
File: 1468472224634.jpg (61KB, 990x557px) Image search: [Google]
1468472224634.jpg
61KB, 990x557px
>>60892088
>muh generics
>>
whats a good text book to get better at programming C/C++ in?

Hell, even just programming in general
>>
Do you listen to podcast, gbros?
>>
>>60892386
https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
>>
>>60892386
The D Programming Language
>>
>>60892386
I'm currently reading Effective Modern C++
>>
>>60892386
c++ primer 5th edition -> effective modern c++
>>
>>60892386
>C/C++
Why are you grouping two completely different languages together?
>>
fine ill just pick up python why not.

whats a good book for it?
>>
>>60892700
there are no good python books
>>
>>60892700
Learn Python The Hard Way is a great book, taught me everything I know about programming and now I got a job and everything
>>
>fell for the Java meme
 public void addSuitcasesFullOfBricks(Container container

look at this shit. its fucking hideous
>>
>>60886977
>Discord
That's your problem.
>>
>>60887459
i hate fuckheads who think that they're above their nature. you're an animal. act like one. jerk off as much as you want, and no less.
>>
>>60892731
extern void addSuitcasesFullOfBricks(Container container
>>
File: hime.png (1MB, 1000x1400px) Image search: [Google]
hime.png
1MB, 1000x1400px
>>60892588
Stop fucking with him man. C++ is nearly a clean superset of C.

Sometimes I come to these threads and it's just meatheaded arguing and I never want to open this stupid website again.

Posting some old /dpt/ OPs since nobody seems to post them anymore and they seem lost among the regulars willing to post these days.

>>60886873
Nice, anon.

>>60886855
As far as I can tell, hasn't for me.
>>
File: dpthime.jpg (156KB, 934x1000px) Image search: [Google]
dpthime.jpg
156KB, 934x1000px
>>60892770
Might've seen this one around, but posting just in case
>>
File: dptzappy.jpg (517KB, 1521x1076px) Image search: [Google]
dptzappy.jpg
517KB, 1521x1076px
>>60892781
Maybe someone posted this a few weeks ago? I hope, at least
>>
>>60892770
>nearly
go to any C project's makefile and change the compiler to g++, see what happens
>>
>>60888410
no. sometimes i'll get stuck on something and start to question my architecture, but when that happens i'll get out a notebook and write down everything that i don't like about the code i've written. when you know what the problem is, the only thing you have to do is write code.
>>
File: mallocast.png (1MB, 1280x720px) Image search: [Google]
mallocast.png
1MB, 1280x720px
>>60892793
Of course any consumer project with millions of lines of code won't build. It wouldn't even get that far anyway since the flags for C++ won't exist.
>>
>>60892770
>I never want to open this stupid website again
Good: I don't want you fag-memer scum around here anyway.
Piss off.
>old /dpt/ OPs
That's not old at all, you fucking newfag.
>>
File: 21119213.jpg (23KB, 424x318px) Image search: [Google]
21119213.jpg
23KB, 424x318px
Trying to replace forward and backslashes in a python string but I can't select the backslash because it reads it as an escape character?

What do?
>>
File: Cprog.jpg (1MB, 1920x1411px) Image search: [Google]
Cprog.jpg
1MB, 1920x1411px
>>60892812
It's not that old but if nobody posts it anymore there's no point

>>60887526
True in practice, but not guaranteed by the spec I'm pretty sure.
>>
>>60892816
pretty sure a double backslash is used for the backslash literal
>>
>>60892810
>>60892781
>>60892770
Himeposting will never die!

NEW THREAD!!

>>60892838
>>60892838
>>
File: haskell.png (786KB, 1000x1300px) Image search: [Google]
haskell.png
786KB, 1000x1300px
>>60892826

>>60892835
Yep, and true in most languages
>>
>>60892835
Thank you anon
>>
>>60892849
for such a pure language, haskell-tan sure is slutty
>>
New thread:
>>60892877
>>60892877
>>60892877
>>
>>60887437
__builtin_popcount(x)
>>
>>60892879
Could you stop spamming the board?
>>
>>60889218
>he doesn't understand how virtual functions are implemented by the compiler

just use a tagged union and call it a day
>>
>>60892887
This is the correct answer, because then G++ will emit a POPCNT instruction, instead of OP's contrived mess.
>>
>>60892770
modern C++ has moved pretty far away from C. even though C++ has retained a lot of compatibility with C there is usually a better way to do something with C++ features. for example you almost never use macros except if they're holdovers from some C library.
>>
>>60892846
Fags BTFO.
>>
>>60892912
>>he doesn't understand how virtual functions are implemented by the compiler
It's certainly nothing like `if actor.type==badguy then badGuyFunction()`, retarded faggot.

Virtual functions are implemented with lookup tables of function pointers, with indices decided on by the compiler. Also called a vtable.
>>
>>60892953
I understand that, but do you think someone trying to learn "C/C++" is going to be trying to deliberately program in two completely different styles at once?
>>
>>60893033
Wonder if it was done on purpose actually
>>
>>60893049
The thread was deleted over 10 minutes after it was created, so it means a janitor did it.
>>
>>60893049
>>60893033
I deleted it, calm down.
>>
>>60893059
I mean the posting before the bump limit with the over the top new thread post. I'm suggesting >>60892846 and >>60893033 might be samefag.
>>
>>60893034
>he thinks it's better to make a conditional branch and raping the cpu with a cache miss
>mfw calling a function pointer at an offset in a table is a single instruction

Wow, you really are retarded.
>>
>>60893034
>>60893265
https://stackoverflow.com/a/20906339/5981535
>>
>>60893265
What the fuck are you going on about? when did I say the branching retardation was better?
Are you literally braindead?
Were you dropped on the head when you were a baby?

vtables are obviously better, I thought my fucking post implied that already.
>>
>>60893392
>vtables aren't branching retardation
Inspect the disasm.
Thread posts: 328
Thread images: 51


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