[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: 315
Thread images: 32

File: 1452715120728.png (338KB, 580x435px) Image search: [Google]
1452715120728.png
338KB, 580x435px
What are you working on, /g/?

Old thread: >>59538415
>>
OOP is shit.
>>
first for brainfuck
>>
File: 1483073157801.jpg (110KB, 1280x720px) Image search: [Google]
1483073157801.jpg
110KB, 1280x720px
Employed Haskell programmer reporting in
>>
>>59543168
darn.
>>
>>59543183
What's your job?
>>
6th for js
>>
File: win32.png (27KB, 535x168px) Image search: [Google]
win32.png
27KB, 535x168px
He's actually right.
t. used to program for Win32 15 years ago.
>>
>>59543012
You put it to sleep 2000, should I put it to 1000 or slightly less? I want it to update on every second, but that varies depending on your computers speed, right?
>>
>>59543244
Windows APIs are probably the worst thing I've ever had the displeasure of using.
>>
>>59543248
You're already doing something weird and not recommended; test it and see what works for you.

I would start with 200 milliseconds (1/5th of a second) and tweak from there.
>>
>>59543270
Care to explain? Win32 is quite full-featured.
>>
>>59543244
>deflecting with a false binary choice
>>
>tfw the 80s chose Sepples instead of Ada
>>
>>59543289
It's not a lack of features that's the problem, it's the API design. Win32 is a backwards-compatibility house of cards and COM is object-oriented wank. It doesn't help that the documentation is shit. User interface stuff is the worst. The details of a window are split up between a window class and the window itself. The window procedure is extremely difficult to turn into a closure (you have to muddle with window user pointers and special messages), some messages have to be handled by the window procedure and some don't, the window class has to be keyed by a unique name, etc. If you're using both Win32 and COM you have to deal with conversions between error codes and HRESULTs. Trying to use Unicode is a bitch because of how it's based on a not-quite correct UTF-16 encoding.

Certain parts of the Windows API are okay. kernel32 and XInput are quite sane.
>>
I'm trying to figure out how objects on the heap and stack work in C++. I don't know the much about the language though and was just curious about this particular feature, so please go easy if I've done something dramatically wrong.

I'm running this bit of code from http://pastebin.com/7ucTaXuF
int main(int argc, char* argv[])
{
Tester test1 = Tester("First");
test1.speak();

cout << endl;
test1 = Tester("Second");
test1.speak();

cout << endl;
Tester* test2 = new Tester("Dynamic");
delete test2;

cout << endl;
return 0;
}


The output is this.
Constructing Tester at 0x7ffd6c849a50 with message First
Hello, World from 0x7ffd6c849a50 with message First

Constructing Tester at 0x7ffd6c849a70 with message Second
Destructing Tester at 0x7ffd6c849a70 with message Second
Hello, World from 0x7ffd6c849a50 with message Second

Constructing Tester at 0xac5070 with message Dynamic
Destructing Tester at 0xac5070 with message Dynamic

Destructing Tester at 0x7ffd6c849a50 with message Second


The bit I'm unsure about is this.
Destructing Tester at 0x7ffd6c849a70 with message Second


I think the destructor is getting called on the object occupying test1, intending to destruct the original object, after it's already been replaced by the new one.
Is this normal, should I just avoid doing this, can I destruct the original object instead?
>>
File: debugging.png (145KB, 1516x957px) Image search: [Google]
debugging.png
145KB, 1516x957px
>>59543141
still debugging my debugger.
>>
File: wheeeeee.jpg (95KB, 244x260px) Image search: [Google]
wheeeeee.jpg
95KB, 244x260px
Rate my sieve of mesothelioma!
It can find all primes under 10 billion in 4 minutes!

#define LIMIT 10000000000
#define BITS (sizeof(char) * CHAR_BIT)
char *a = (char *) calloc(LIMIT / BITS, sizeof(char));
size_t i, j, sum = 0, sq = sqrt(LIMIT);
for (i = 3; i < sq; i += 2) /* skip all even numbers */
if (!(a[i / BITS] & (1 << (i % BITS))))
for (j = i * 2; j < LIMIT; j += i)
a[j / BITS] |= (1 << (j % BITS));
>>
File: 1467434345362.jpg (63KB, 500x281px) Image search: [Google]
1467434345362.jpg
63KB, 500x281px
>>59543507
unreadable/readable
>>
how hard is to program a calculator in assembler?
>>
>>59543551
roughly sqrt(5/7)
>>
>>59543551
but your processor already has ALU you dumb nigger.
>>
>>59543507
cancer/10
>>
>>59543141
Why is there an anime girl in your room anon?
>>
>>59543458
This is what you would want to happen. Test1 could be a massive object sitting in memory, so before re-assigning Test1 variable, you would want to "free" (deconstruct) the object it currently "holds", before assignment to constructed rval. Assuming lhs != rhs ofc.
>>
File: 1488174359754.gif (1MB, 195x229px) Image search: [Google]
1488174359754.gif
1MB, 195x229px
>>59543578
oh fuck
>>
>>59543565
is that kilometres or miles
>>
File: [questioning female].png (407KB, 549x413px) Image search: [Google]
[questioning female].png
407KB, 549x413px
>>59543244
>subjective opinion from someone who's pushing a political agenda
>He's actually right.
>>
File: 1471753950593.jpg (115KB, 1280x720px) Image search: [Google]
1471753950593.jpg
115KB, 1280x720px
>>59543591
>he doesn't have an anime girl in his room
>>
Best Audio C++ library?
>>
>>59543551
If you can hardcode your input, then fairly easy. Use RPN notation and your stack can be some close by mem. loc. Walk down characters in input, determine type, and either push onto stack or pop (and eval top two stack items). Then check if you're done, pop last item off as answer.
>>
Why don't they just call modulo the "wrap around" operator, because I only ever see it used as a cheap hack to prevent writing off the end of an array bound.
>>
>>59543189
Writing Haskell programs for the military.
>>
>>59543673
It's an integral part of FizzBuzz though.
>>
>>59543685
Which one?
>>
>>59543695
the fizzbuzz operator
>>
>>59543673
It's actually the remainder operator, because it can output negative numbers when used on signed number types.
>>
i have the following rules in my grammar:

VarDecl = Variable Declaration
Stats = Statements

MethodBody -> VarDecl Stats
MethodBody -> Stats VarDecl
MethodBody -> VarDecl
MethodBody -> Stats
MethodBody -> % empty


how do i add a recursive rule to MethodBody to allow Variable Declarations and Statements to be mixed up?
>>
>>59543244
Saying "actually" doesn't validate you anymore than just making the undecorated assertion.
>>
>>59543703
That information is classified NOFORN.
>>
>>59543507
How am I supposed to read resulting array a to get primes?
>>
>>59543728
Actually that's not true
>>
>>59543458
Overload the assignment operator with a message and you'll see what's happening. You're constructing a temporary object at 0x...a70, then assigning it to the object at 0x...a50, then destructing the temporary.
>>
File: F-35A_flight_(cropped).jpg (26KB, 640x460px) Image search: [Google]
F-35A_flight_(cropped).jpg
26KB, 640x460px
>>59543743
Well, US military can afford to pour money into the drain.
>>
>>59543757
Like this?
for (i = 2; i < LIMIT; i += (i > 2) ? 2 : 1)
if (!(a[i / BITS] & (1 << (i % BITS))))
/* i is a prime */;
>>
>>59543757
A for loop.
>>
>>59543717
mb: statement methodbody
| decl methodbody
| empty
>>
>>59543761

Yeah, I figured that out once I paid closer attention to the addresses.
But it seems like the original object is never being destructed. It just gets overwritten in-place.

Is it possible to destruct the original object at 0x...a50 before copying the new object there?
Is it possible to construct the new object in place at 0x...a50, without the temporary buffer?
>>
>>59543326
Hindsight is 20/20
>>
>>59543774
>US military can afford to pour money into the drain.
It's still money better spent than what e.g. Apple would do with it.
>>
>>59543787
thanks grammar master!
>>
>>59543829
> Is it possible to destruct the original object at 0x...a50 before copying the new object there?

> Is it possible to construct the new object in place at 0x...a50, without the temporary buffer?

Like this if I remember correctly:

test1.~Tester(); // Destruct the original object.
::new (&test1) Tester(); // Create a new one in the same location.
>>
>>59543857
>Creating useless weapons is better than creating useless consumer products
I don't think so.
>>
>>59543892
weapons definitionally have a use
>>
>>59543780
Why is it supposed to work?
>>
>>59543873

Cheers.
>>
>>59543892
Weapons are never useless. Killing is the ultimate expression of your humanity.
>>
>>59543918
fedora
>>
>>59543906
Because I stored the prime lookup table in an array of 8 bit bitfields each instead of 1 byte per prime?
>>
>>59543925
Subhuman.
>>
>>59543955
fleas=14
>>
programming is ez u just have to be careful

compiling on the other hand
>>
File: chimp_war.png (55KB, 326x537px) Image search: [Google]
chimp_war.png
55KB, 326x537px
>>59543918
No it's not, animals kill each other too. If anything, consumerism is a better expression of our humanity.
>>
>>59543892
Actually, much of what military does has a non military purpose in mind. Military sometimes acts as a money sink for public services. Remember that one thing they did - the internet?
>>
freshman in csci taking my first programming class and i have to make a c program that takes 2 integer arguments from the command line and averages them. help?
>>
>>59543999
not again
>>
File: rip-chicken.png (23KB, 486x556px) Image search: [Google]
rip-chicken.png
23KB, 486x556px
>>
>>59543996
The internet is a weapon in the war of memes.
>>
>>59543988
>implying my dog doesn't consume everything in front of him
>>
>>59543996
So why not give the money directly to the civilian purposes, without having military taking its cut?
>>
>>59543934
0 represent primes and 1 represent non-primes?
>>
>>59544029
Call your republican congressman and ask him.
>>
>>59544059
yes
>>
>>59544068
why not just use an array of bools in a language with 1 bit bools
>>
>>59544084
Any language with a bool primitive type is just using the first bit of a byte and discarding the rest, you can't address a single bit without storing the whole byte.

You can verify that this works by checking your ram usage.
This version only uses 250MB to get all primes under 2 billion, and it would require 1.5GB if it was doing it the normal way with wasteful arrays of bool values.
>>
How do I add monads to my language?
>>
I'm building algos and data-structures in js as a challenge for myself and testing this shit with console.log statements is clearly not the best way of going about it.

How long will it take to learn a test framework like Mocha?
>>
>>59544153
data Monad m = Monad { (>>=) :: forall a b. m a -> (a -> m b) -> m b ; return :: forall a. a -> m a }
>>
>>59544195
so the only prerequisite would be having the ability to declare custom datatypes?
>>
File: 1485374843913.jpg (69KB, 699x485px) Image search: [Google]
1485374843913.jpg
69KB, 699x485px
>>59543141
I'm furbishing my greatest memes for the next meme war
>>
>>59544121
>He can't bit pack arrays and records
Kek, what?
>>
>>59544153
They're probably already there.
>>
>>59544224
you basically want your compiler doing this for you without thinking about it, right?
>>
>>59544220
well you could do this instead

bindList :: List a -> (a -> List b) -> List b
returnList :: a -> List a
...
bindMaybe
bindIO
...
etc
>>
>>59544240
Yes?
>>
>>59544239
That isn't likely since it would require someone other than me modifying the source code.
>>59544242
That's what I'll probably do for now then.
>>
>>59544281
you need parametric polymorphism and generics

please add do notation
>>
File: prime_array.png (2KB, 355x64px) Image search: [Google]
prime_array.png
2KB, 355x64px
>>59544068
It makes sense now. Very nice implementation!
The only problem I see are reversed indices per byte basis, but the other way, I suppose, would be more resource demanding.
>>
so I am trying to learn how to scrap data from a website. trying to do the psn store right now.

using python and the requests and beautiful soup library. The problem is when I try to thelink = requests.get("link") and print thelink.content, but what I am getting is not the same html doc as if I was to go onto the website in chrome and right click - > inspect

I am probably just retarded or something though and using it wrong.
>>
>>59544298
>you need parametric polymorphism
Already have that.
Not sure what you mean by generics though.
>>
>>59544345
type constructors of kind (Type -> Type)
>>
Google:
Let's optimise this C++ method using a retroactive data structure and metaheuristic and then use Python binding for an easy management of the computation sessions.

/dpt/:
Moar fucntional programmeng lisp haskel, OOP is sheeiiiit poo in loo!!
>>
>>59544386
/dpt/ is right
>>
>>59544386
google's led by indians
>>
hey guys, can you sell me on functional programming.. i mean what does it even mean? passing functions around as params.. recursion ehm? why do people separate it from programming in general?
>>
>>59544427
Functional programming is about expressing computation as pipelines of transformations rather than sequences of instructions.
>>
>>59544427
>why do people separate it from programming in general?
Sekret club syndrome
>>
>>59544427
>hey guys, can you sell me on functional programming..
it's safe and concise
>i mean what does it even mean?
functions take inputs and return outputs without any sort of side effect
>>
>>59544427
Functional program is at its best when nested within an imperative language that also has the ability to utilize OOP.
>>
>>59544427
it just works
>>
>>59544480

This guy gets it.
>>
>>59544386
>lisp
Supports fuctional programming; not functional at all.
>>
>no 100 posts bumplimit
>>
>>59544480
functional programming with java is asscancer. google cinnameg, it's the language of the 22nd century
>>
>>59544509
No one said anything about Java.
>>
>>59544497
>lisp is not functional at all
..
>>
>>59544480
I know Lisp supports that; I think Haskell does not. Is it there any other language?
Ruby is kinda imperative and hard OOP.
>>
>>59544522
wrong: i did
>>
>>59544531
(setq n t)

>functional
Kill yourself.
>>
>>59544480
bait
>>
>>59544480
Imperative I can understand as long as you have substructural types. OOP, why? You can do encapsulation without OOP and with dependent types you don't even need encapsulation.
>>
>>59544555
>Imperative I can understand as long as you have substructural types
Huh?
You don't need to understand imperative much
>>
>>59544531
> doesn't have type system
> functional
Lisp is just Python with awkward syntax.
>>
>>59544555
because it's useful for some things
>>
>>59544573
What I mean is that I can understand why functional programming is best in an imperative language, as long as you have substructural types to make mutation into a first class effect and not a side effect. Trying to do purely declarative systems programming would be a bitch.

>>59544599
Such as?
>>
>>59544584
Has Python macros? No.
Is Python's code data aswell? No.
Is Python (scripting language) compiled? No.
Has Python good performance? No.
>>
>>59544446
>pipelines of transformations
but what does it mean

>>59544454
>>59544460
>>59544480
>>59544484
so if i write a class and some methods set state and doesn't return, some methods return and set states, some methods only return based on input, some return themselves so i could daisychain, what does that make, is it still oop? or do functional limits you to use only a subset of techniques?
>>
>>59544599
Polymorphism and inheritance can be good things when used effectively.
>>
>>59544618
>Such as?
game development
>>59544584
first off we're not arguing whether it's a purely functional language, he said it's not functional at all. it has maps, folds, lambdas, function composition, partial application.. that's a lot of functional components. scheme is especially functional. the entire language is just arguments being applied to a function
>>
>>59544659
All of these have nothing to do with being functional tho.
>>
>>59544664
just use the state monad
>>
>>59544664
Does it matter?

Good code does the job well, and is easy to maintain.

If you use objects to attain some polymorphism/inheritance and combine that with some functional-flavored tools to accomplish your task, you don't need to worry about labeling it as OOP/funcitonal/imperative/whatever paradigm.
>>
>>59544686
But what if I am ancap
>>
>>59544573
>>59544618
Though, at the same time, imperative programming can be modeled in declarative programming as continuation passing style (this is what do notation does). There's little difference in principle, it's just what the primary syntax is.

>>59544665
Polymorphism is a concept much more general than OOP. OOP polymorphism pretty much refers exclusively to subtype polymorphism, whereas functional programmers have been talking about parametric, ad hoc, and row polymorphism (the latter is basically better subtype polymorphism) for a long time.

Inheritance is just bad.

>>59544671
OOP isn't good for games.
>>
>>59544702
>OOP isn't good for games.
now that's just wrong
>>
>>59544700
just use the NAP monad
>>
>>59544671
>he said it's not functional at all
http://letoverlambda.com/index.cl/guest/chap5.html

>>59544702
>OOP isn't good for games.
Tell me how it's not good for games. I've been trying to avoid it for years.
>>
>>59544702
>OOP isn't good for games.
>Inheritance is just bad.

Holy fuck I'm SO going to post a smug anime face if you don't stop spouting dumb bullshit.
>>
>>59544725
ah yes, letoverlambda.com, lisp definitely doesn't have those functional components i previously mentioned now i've read that 1990's style website
>>
>>59544702
>OOP isn't good for games.
OOP is the right choice for games. Anything else is a poor match for the problem domain. Games are simulations. OOP is exactly what you want for modeling a simulation.
>>
>>59544714
>>59544725
>>59544744
>>59544758
Procedural organization (composing pure data and using free functions instead of methods) is better for code reuse and optimization. This is the conclusion of all the entity systems and data oriented design stuff that's been becoming more widespread over the last decade or so.
>>
>>59544758
oop doesn't respect how the underlying hardware works
>>
http://www.strawpoll.me/12592790
>>
>>59544764
>entity systems
Did you mean
>buzzword snakeoil
>>
>>59544783
>((((((common lisp))) (((or))) (((scheme))))))
I want a third option
>>
>>59544798
it's a lisp poll though
>>
>>59544787
Most entity system literature is pretty bad and has little attention paid to optimization but the underlying ideas concerning code reuse are sound.

http://boreal.aggydaggy.com/programming/2016/05/26/entity-safari.html
>>
File: 1467875762304.jpg (13KB, 251x283px) Image search: [Google]
1467875762304.jpg
13KB, 251x283px
>>59544806
you could have warned me
>>
>>59544809
The whole notion is simply wrong. Usually when people say "ECS" they just mean "good OOP" but they don't know what that is.
>>
File: a25.png (542KB, 811x710px) Image search: [Google]
a25.png
542KB, 811x710px
>>59544754
Like I said, lisp «««supports»»» functional programming; but it's not functional. Do you want me to say "pure" functional?. Yes, it's not pure functional.

>>59544744
pic related
>>
File: screenshot-[20:05:14].jpg (223KB, 1024x800px) Image search: [Google]
screenshot-[20:05:14].jpg
223KB, 1024x800px
rate my awwwright multi-threaded mandlebrot viewer, [spoiler]it isn't completely finished[/spoiler]

https://github.com/goatsejpg/mandelbrot-viewer
>>
>>59544841
you said it's not functional at all, nice backtracking
>>
>>59544783
>no "Neither" option
>>
>>59544826
Elaborate. Sure, "good OOP" these days does admit that composition is better than inheritance. However, having code in methods adds boilerplate to composition (which is why inheritance exists, it's just a special case of composition that automates the boilerplate). All you have to do to fix composition is to stop using methods.
>>
>>59544847
>https://github.com/goatsejpg/mandelbrot-viewer
>C++
0/10
>>
>>59544847
should've used D
>>
>>59544854
>composition is better than inheritance
The people who say this don't understand the difference between inheritance and subtyping. Inheritance is good OOP. Subtyping is not.
>>
>>59544863
>>59544873
i must have forgot /dpt/ is nothing but people autistically screeching about that their language is better
>>
>>59544847
>sdl
>raw pointers
>passing events to render functions
>including headers twice
>c time
>c style casts
>>
>>59544863
more like c with classes
>>
>>59544884
Inheritance has a lot of issues. Even mixin inheritance has problems because what happens if you want mixins to interact with one another? Then you need to go with free functions again and you might as well have just done that from the beginning, assuming you're even using a language that supports it.

Inheritance leads to a combinatorial explosion of classes. Composition of objects with their own methods leads to boilerplate. Composition of data (if you don't have dependent types, you do need to specify invariants with getters/setters unfortunately) and putting behaviour in free functions doesn't have any drawbacks.
>>
>>59544333

just to clarify what I mean, this is what I am doing

 
r2 = requests.get("https://store.playstation.com/#!/en-us/2-for-1/cid=STORE-MSF77008-PLAYCOLLMULTIBUY")

print r2.content


all I am trying to do is grab the html off a website using python. So I just want to be able to read the same thing as if I were to right click->inspect
>>
L I B S H I T
I
B
S
H
I
T
>>
>>59544979
You need a 3D printer to do that.
You can't print a Playstation.
>>
>mixins
Name a more retarded term than this.
>>
>>59545018
object oriented programming
>>
>>59545018
infix
postfix
>>
>>59545026
Whats with object? Use it at my job all the time
>>
fn main() {
//Prevention of double free
let string1 = String::from("Hello");
let string2 = string1; //this invalidates string1 and does a shallow copy.
//the cobmination of these two operations are called "move"
println!("{}", string2); //string1 is no longer valid

//if you want deep copy add .clone() at the end of expression
//let string2 = string1.copy();
}


>>59544886
As a D fag, I like C++.
>>
>>59544939
cheers
>>
>>59545042
Braindead setters and getters
Bloated "features"
Most times forced to do oop because "standarization" when a function or clojure would do the same thing much easier.
>>
Lisp is such trash. Anyone using it should be publicly executed.
>>
>>59545076
closure*
>>
>>59545042
You can't use OOP to store data about women in a database
>>
>>59545087
C*
>>
>>59545087
delete this one mate
>>
>>59545087
Enjoy your copy pasted code.
>>
>>59545087
Anyone using it already suffers enough.
>>
Here's my impression of dpt users:
>I hate productivity!
What do you think?
>>
>>59545163
Thank you, sir, may I have another?
>>
>>59545163
Add
>MUUH 0.001% performance gain
>Fuck those employed people for using libraires
>>
>>59545163
>I hate OOP cuz I don't understand it xDDDDD
>>
>>59545183
>C(ancer)!
>>
>>59545163
>Usefulness is for losers
>>
>>59545163
>>59545187
>>59545196
>>59545206
>>59545217
Who said that? Why are you quoting it?
>>
>>59545163
>Produce programs? lol no I'd rather allocate 98 bytes to my super secrit void ** and free them right after I figure out which of my 32 undefined behaviors is causing my program to segfault
>>
>>59545163
>I am an embedded kernel developer, trust me
>>
>>59545163
public static interface class abstract myClassIsVeryProductive
{
public static void int abstract interface veryEfficientAndFastMethod(abstract myClassIsVeryProductive productiveInstance)
{
productiveInstance = productiveInstance;
return;
}
}
>>
>>59545163
Most of /dpt/ are either first year undergrad or high school drop out who think their baseless shitty opinion matters. C toddlers are a prime example
>>
>>59545237
>camelCase function names
disgusting
>>
>>59545268
>function names
disgusting.
>>
>>59545268
It's been proven to improve speed by 120%
>>
>>59545283
That's just your shitty WPM
>>
File: Altera_StratixIVGX_FPGA.jpg (86KB, 504x337px) Image search: [Google]
Altera_StratixIVGX_FPGA.jpg
86KB, 504x337px
I'm trying to find out if I can afford to mess with FPGA. Roughly, how many logic blocks are required to implement simple 16-bit CPUs?

The only boards I'm comfortable with buying have only 6K LEs, which is really not a lot, as I'm starting to realize. But maybe that's enough for my purposes?
>>
>>59545163
>HAVING NO FEATURES IS A FEATURE EXDEE
>>
>>59545371
>muh features
>>
>>59545385
>muh lack of features
>>
File: 1490127977090.png (440KB, 657x527px) Image search: [Google]
1490127977090.png
440KB, 657x527px
>>59545371
>>59545385
>I need muh features to program like a big boy
>>
Neeeeerds
>>
>>59545385
>>59545394
guess that concludes the argument guys
>>
File: 1455950055870.jpg (32KB, 300x470px) Image search: [Google]
1455950055870.jpg
32KB, 300x470px
>>59545402
>I don't need features to program cuz I'm a big boi
>>
>>59545402
>Le norman ROOOO why do they need features :DDDD
>>
>>59545402
dumb frogposter
>>
>>59545237
You can't be an interface and a class and putting abstract on interfaces is redundant.
>>
File: 1489499813799.jpg (90KB, 957x621px) Image search: [Google]
1489499813799.jpg
90KB, 957x621px
>>59545449
>>59545439
>>59545455
stfu big boi
>>
>>59545467
>>59545268
>not noticing the sarcasm
>>
>>59545474
Big bois are busy giving ur mum dicks while you are busy with allocating memory to void types
>>
>>59545487
void *mem = (void*)malloc(n);
>>
>>59545477
Not acknowledging and not noticing are two different things. You're not being clever, you're just pretending to be retarded.
>>
void func(int);

int main(int,char**) {
void x = func(3);
return 0;
}
>>
>>59545477
Trying to misrepresent something through an exaggeration that isn't even correct code doesn't really work here.
>>
>>59545506
don't cast malloc and use calloc
>>
Is hackerrank good or are there better websites of that type?
>>
>>59545552
>calloc
no way
>>
>>59545586
yes way
>>
>>59545610
You rarely need to set allocated memory to zero.
>>
>>59545163
I think you are good at fishing (you)s
>>
>>59545621
Yet you rarely need to read garbage if you happen to read allocated memory.
>>
>>59545673
If you never wrote to it, a zero is equally garbage.
>>
>>59545673
I will set it to what I want. So I don't need a double pass.

filthy code monkey
>>
>>59545673
Why would you read memory you haven't set?
>>
>>59545715
pseudoramdom gemerator
>>
>>59545777
:/
>>
>>59543673
It gets remainders from divisions you dumb brainlet.

I've used it hundreds of times to do a function on a certain multiple.
>>
>>59545568
wreck every rank you stumble on
>>
CL-USER> (/ 1 2)
1/2

Lisp Master Race
>>
>>59545964
Remainder and modulus aren't synonymous
>>
File: Screenshot_2017-03-23_23-36-48.png (94KB, 685x441px) Image search: [Google]
Screenshot_2017-03-23_23-36-48.png
94KB, 685x441px
>>59543141
>What are you working on, /g/?
Making deleted posts revealable, so mods can't use it to censor abusively. The server-side is about done, but the way these are toggled on the client needs work. Would prefer it in pure CSS/HTML, so it works with noscript.
>>
>>59546313
Not for 4chan.
>>
File: anal beads.png (38KB, 775x333px) Image search: [Google]
anal beads.png
38KB, 775x333px
>>59546333
?
>>
>>59546282
why don't you just use 4chanx?
>>
>>59546391
Because it's not 4chan, but an imageboard engine I am writing.
>>
>>59546333
>>59546424
Oh you meant "This isn't for 4chan."
>>
>>59546424
Carry on then
>>
>>59546282
You can try to make your engine work with Dollchan Extension Tools.
>>
What is the CSS for GUI development if I don't want to use C++/QML?
>>
File: gccwtf.png (22KB, 520x592px) Image search: [Google]
gccwtf.png
22KB, 520x592px
what does this do and why does gcc think it's necessary?
>>
>>59546463
You don't need such a thing when you can code.
>>
>>59546463
C#/XAML
>>
I know a little C, and I landed a job that requires me to know some C++

How hard is the transition and whats the best resource to learn?
>>
>>59546460
It would actually be a lot more work than simply adding those features to the engine itself. There are many core differences, that do not follow the classical 4chan/Tinyboard architecture.

>>59546463
There is none. QML is the closest thing to HTML/CSS for native GUI. Or you could be gay faggot and use Electron.
>>
>>59546484
It's to align the function to a 16 byte boundary, which is more efficient for some reason.
It's probably has something to do with caches or some shit.
>>
>>59546528
>Job requires C++, not C
No shit
>How hard is the transition and whats the best resource to learn?
Depends. If you are not able to write idiomatic C++ you will not even get the job, so start reading books
>>
>>59546531
>classical 4chan/Tinyboard
Well, how much does it differ from Wakaba?
>>
>>59546553
Are books the best resource?
>>
Any comfy coding chats I could join?
>>
>>59546631
>coding
>>
>>59546603
Yes
>>
>>59546631
>coding
I think /wdg/ has its own discord server
>>
>>59546631
IRC
>>
>>59546561
Plenty. I'd say it only looks like classical image boards, but the HTML, CSS, API structure and commit method are completely different. It's much easier to look up a feature and reverse engineer it, than patch existing extensions.
>>
>>59546631
Just throw some shit in the thread and the speed of new messages becomes comparable to chat speed.
>>
>>59546664
what server and channel
>>
>>59546716
Your language on freenode
>>
>>59546729
those aren't good channels...
>>
Thing is, C/C++'s syntax looks so cluttered I'd prefer not to look at their codes, I've been spoiled by D in a sense
>>
>>59546774
>C/C++'s syntax
What a fucking retarded thing to say.
C and C++'s syntaxes are completely different.
>>
>>59546782
C++ is compatible to C in the source level (mostly)
>>
File: C++ in a nutshell.png (72KB, 1016x98px) Image search: [Google]
C++ in a nutshell.png
72KB, 1016x98px
>>59546791
No, it's fucking not.
>>
>>59546774
>>59546463
I need to learn C++ *just so* that I can read and understand QML/Qt docs.

What's the quickest and the shortest book for it?
>>
>>59546831
>C++
>shortest

>>59546825
what does this do
>>
>>59546825
You can write C in a C++ file
>>
>>59546841
pls anon, I don't like C++ either but I do like QML
>>
>>59546859
struct a { const char *str; };
struct a arr[] = {
[10] = { .str = "You're fucking stupid" },
};
>>
What's the best programming language?
>>
>>59546911
Rust
>>
>>59546869
I've worked some with QML and know C, but don't know C++. If you know a little bit about OOP and can google, you'll be fine as you are.
>>
>>59546911
c++17
>>
>>59546882
He didn't say you can write any C code in C++.
>>
>>59546911
If you want to do it right, C.
If you want to be a memer who just glues libraries together, Python.
>>
>>59546925
You don't use any libraries? No way!
>>
>>59546911
PL/1
>>
>>59546911
Binary
>>
>>59546924
It was implied. A reasonable person would think that was a universal statement, not an existential one, otherwise it becomes completely useless to say.
You can write Javascript in C++ as well!
a = b;
>>
>>59546924
By that logic you can write C in any language with similar syntax. Just not any C.
>>
Hello, /dpt/! I'm not a regular here, but I figured you guys would be the best to ask this.

I'm a university student in MonkeyLand, studying Systems Analysis and Development. I'm really interested in programming and believe I've made a good progress. I'm learning Java at uni (pls no hate) and Python on the side. I understand and can make all "basic" algorithms, in Java and in Python, and I've began a bunch of projects, but I can't find "something" that I want to do.
I'm not really interested in web, but I can't find any area that I think would be interesting enough. I know I can escape being a code monkey, at least in the beggining, but I want to do something fun/interesting/challenging, and become good at it.
I began developing some shitty games that I never finish, tried some web work with Django/Flask, started learning HTML, began a course on Machine Learning... We have so much options, but I don't feel I've clicked with anything yet.
I know it's a noob dillemma, and it may seem like a childish thing, but I feel like this is "my" thing, I just don't know which way to go about it.

Can you guys give me options, paths, maybe experiences about what you do? I don't mind not being the best or becoming a millionaire, as long as I'm enjoying what I do. My future objective is, when I get another notebook, using my old one, create a small home server and learn a bit more about web, creating a mail server, ftp, maybe making my own site to host my stuff... I'm also gonna finish the Coursera's Machine Learning course and maybe learn a bit more about back-end web development, but I'm still very lost about everything.

Sorry for any confusion, and thanks!
>>
>>59546932
I didn't say that. I said that python memers are ONLY capable of glueing libraries together, meaning that they aren't capable of producing anything of value themselves.
>>
>>59546979
You produce anything of values without using pre written libraries? No way!
>>
>>59546975
If you have a hobby other than programming, try to find something there that could be automated or improved related to that.
>>
>>59547002
import fourchan

fourchan.shitpost(59547002, ":^)")
>>
>>59547047
lib_4chan
>>
>>59547026
I like playing games. Wasted most of my teen years doing it lol.

Another idea I have is creating "my" website where I host all the shit I make, I was really interested in making a chatbot and just put that there, maybe share it with my fellow anons so they could fuck it, like Tay, I guess that with an audience I would have at least someone to not dissappoint.
>>
>>59547081
>lol
>>>/r/eddit
>>
>>59547095
Sorry, bad internet habits.
>>
>>59546979
>""""""memers""""""
>>>/r/ibbit
>>
File: C41ecKSVcAMfqxO.jpg (37KB, 675x1200px) Image search: [Google]
C41ecKSVcAMfqxO.jpg
37KB, 675x1200px
Shit brainlets say
>λf.λx.x
>>
why cant i grasp OOP
>>
>>59547171
Because it's stupid, unintuitive way of programming.
>>
>>59547171
the most obvious reason would be you not having indian genes.
>>
>>59547081
Maybe you should stop playing video games, for one, but I would recommend random little projects to solve issues.

These are not meant to be massive and professional. It's practice, but you need something that will interest you enough to want to finish it. Like going to a website and downloading all the images from it or something. Whatever.

Or you can tinker with a finished project already. I began with messing around with things and editing them to see what would happen. That kept my interest long enough. For example, take an Android application and mess around with the colors. Doesn't matter. Then I began slowly making my own little projects. Then it just evolved from there.
>>
>>59547081
What, kind of games? You could make mods for them, you could listen to the memory and make stats of some of the data. You could create cheats.
>>
how do you handle SQL migrations in CI servers like jenkins?
>>
is this some where i can come for advice if i am truly stuck and have attempted things a fair amount of times in different ways based on my experience and ability to research?

I'm still a noob and i am working on a big project, i am okay so far but i know im gunna get stuck eventually. Would be awesome if there was someone use to c++ who would mentor me.
>>
>>59547352
> I'm still a noob and i am working on a big project,
Maybe ask your seniors?
>>
File: 1485196313281.png (183KB, 378x307px) Image search: [Google]
1485196313281.png
183KB, 378x307px
Am I a calculus of constructions?
>>
>>59547409
i'm still studying, i came in when the course changed from a diploma to a degree and most people were they from the start. so a lot is assumed to already be known.

I understand how a system would work but when it comes to being fluent in coding i really struggle. I thrive from having a job and learning a role as opposed to learning from powerpoints or whatever
>>
I swear git is the worst fucking piece of shit ever created.
How the fuck command line shit is still a thing in 2017?
>>
>>59547797
2/10 Try harder.
>>
>>59547815
fuck you
>>
File: e9d[1].jpg (16KB, 600x600px) Image search: [Google]
e9d[1].jpg
16KB, 600x600px
>>59547797
>>
>What are you working on, /g/?

trying to figure out why using a hrtimer causes a kernel oops on my raspberry pi
>>
>>59545163
Haskell is the most productive language
>>
>>59543168
I wrote fizzbuzz in brainfuck and then vowed never to touch it again.
>>
>>59547229
No job related stuff in this thread
>>
>>59548221
Now try it in Malbolge :^)
>>
>>59548270
It's more sane to write an NN to generate a fizzbuzz in Malbolge.
>>
>>59548356
NN?
>>
>>59548377
Neural Network.
>>
>>59548109
That's why everybody uses it, obviously!
>>
>>59548109
>>59548385
dysfunctional programming is a meme
>>
>>59547852
surprise surprise, it's because I'm an idiot
>>
File: epic.png (25KB, 770x645px) Image search: [Google]
epic.png
25KB, 770x645px
What did my professor mean by this?
>>
>>59547797
Give up programming. Honest advice
>>
>>59548800
Write "install gentoo" in each space
>>
>>59548800
Just &%rax you tard
>>
File: 1475566478922.png (1MB, 1217x858px) Image search: [Google]
1475566478922.png
1MB, 1217x858px
Can you think of examples of languages used incorrectly, not the way these languages were intended?
>>
>>59543141
What is a good opensource project to dive into for a beginner C developer?
>>
>>59549047
Lisp interpreter
>>
>>59544460
top kek
>>
>>59549021
Haskell being used at all instead of being put into the trash
>>
>>59549057
>interpreting trash in trash
Good idea.
>>
New thread:

>>59549111
>>59549111
>>59549111
>>
>>59545056
would
string2 = string1 + string3;
invalidate both string1 and string3?
>>
>>59544702
> OOP polymorphism pretty much refers exclusively to subtype polymorphism

Sorry, but you're wrong. Subtype polymorphism (or interface inheritance) can actually be a good thing for OOP languages, unfortunately most OOP languages go for implementation inheritance which is actually bad.

> whereas functional programmers have been talking about parametric, ad hoc, and row polymorphism

Sorry, but skimming over Wikipedia article doesn't make you an expert on FP, nor does thoughtlessly shitting on OOP.
>>
@59549355
>plebbit spacing
>'>' spacing
>POO lover
this is pretty surprising.
Thread posts: 315
Thread images: 32


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

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


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