/dpt/ - Daily Programming Thread

Oliver Kelly
Oliver Kelly

old thread: /g/thread/63519107#p63519107

What are you working on, Sup Forums?

All urls found in this thread:
https://splinter.readthedocs.io
http://www.strawpoll.me/14467509
https://github.com/torvalds/linux/pull/486
https://mitpress.mit.edu/books/introduction-algorithms
https://forums.somethingawful.com/showthread.php?threadid=3376083&pagenumber=518&perpage=40#post475472345
https://www.coursera.org/learn/learning-how-to-learn
https://youtu.be/077FVwZ1mlE
https://danluu.com/julialang/
https://news.ycombinator.com/item?id=11073223
https://github.com/maxpert/raspchat/releases/tag/v1.0.0-alpha
https://news.ycombinator.com/item?id=11759762
Christian Jenkins
Christian Jenkins

How do people do code review in professional environment?

Juan Lee
Juan Lee

Back from old thread

Fuck.
I have been trying to get more into programming but I lack the focus. I know some Haskell, Python, and I want to learn more C. I love programming so much just I hate the learning part... I have a nice little book but I cant help straying from learning to go on Sup Forums or misc distractions

Please help Sup Forums

Oliver Long
Oliver Long

good op

Leo White
Leo White

tfw Sup Forums read the chineese cartoon edition of K&R

Lincoln Nelson
Lincoln Nelson

Reminder that if you use data and functions and those functions operate on that data then you're doing OOP!

Austin Sanchez
Austin Sanchez

I love programming so much just I hate the learning part
that's literally half the fun of programming. Find a new hobby lad.

Lincoln Perry
Lincoln Perry

which languages are best for ___ tech sectors?

Java?
C#?
C++?
JS?

Trying to decide what to learn if I plan to NOT work in silicon valley and work in Southern US tech industry.

Jaxson Gutierrez
Jaxson Gutierrez

I only use functions with linear types.

Kayden James
Kayden James

You push your code to your working branch of the Git/TFS repository, then you tell the reviewer that you pushed it, then they reviews it. And then at some point it gets merged into the staging branch then eventually into production.

Gabriel Nelson
Gabriel Nelson

C++

Adrian Price
Adrian Price

Sorry, let me elaborate

I hate just having to sit down and focus for long times, and it irritates me most when im reading and learning. I like the learning part itself but i cant go longer than 1 hour...

And does anyone know a good book for learning C? I heard Zed A Shaw has some good ones, and the C programming manual is a bit old.... I dont mind using whitepapers either

Kayden Butler
Kayden Butler

Ok, let's compile a list of programming related books that are good to read while taking a dump (i.e. they don't require pen/paper or pc to do exercises but are still good for you). I'll start

- Pragmatic programmer
- Code complete
- Mythical man month

what else

Nathan Stewart
Nathan Stewart

I hate just having to sit down and focus for long times
find a genre of repetitive and upbeat music, stop alt-tabbing every 2 minutes to Sup Forums.

Christopher Hill
Christopher Hill

Oh, so kinda like prs in opensource world?

Michael Rogers
Michael Rogers

I heard Zed A Shaw has some good ones
I thought everybody hated Zed Shaw.

this also, use fullscreen modes, different desktops, etc.

James White
James White

C99 (ISO/IEC 9899:TC3)

Jacob Thomas
Jacob Thomas

Pretty much, just with more interaction.

Michael Price
Michael Price

Alrighty, thanks guys. I appreciate it.
Now, what about a good book/pdf to learn C?

Nolan James
Nolan James

Type-level functions? Interesting... so your program effectively runs at compile time?

Matthew Ramirez
Matthew Ramirez

virgin programmer - K&R
chad coder - ISO/IEC 9899:1999

Carter Brooks
Carter Brooks

what

John Gonzalez
John Gonzalez

Friendly reminder that C has generics.

Brody Morgan
Brody Morgan

Post github portfolio red flags
he has a configs repo full of riced configs
it's the most frequently commited repo on his profile
his commit punchcard shows all his commits happen between 2-4am
he has multiple commits a day, all of them tiny trivial changes
he has an anime girl profile pic
he contributes to projects full of other users with anime profile pics
all of his projects revolve around viewing video or sorting anime pics or ricing their desktop

Parker Perry
Parker Perry

for which industries?

I hear python is good for data analytics

Nolan Martin
Nolan Martin

he has an anime girl profile pic
he contributes to projects full of other users with anime profile pics
insta hired

Aaron Hernandez
Aaron Hernandez

open indeed.com
lurk in your area
decide

Jaxson Perez
Jaxson Perez

aliasing != generics

Caleb Nguyen
Caleb Nguyen

The majority of the repos are forks and not personal projects
Every repo is an unfinished “Playing with <language>” sandbox
Only JS repos

Evan Perez
Evan Perez

he has a lot more stars than me
don't hire because jealous

Mason Sanchez
Mason Sanchez

Threadly reminder that 98% of you don't actually program. (No, fizzbuzz doesn't count)

Xavier Gray
Xavier Gray

Do Javascript if you want to spend all your time worrying about the idiosyncrasies of browsers and constantly be dictated to about tiny little UI interactions and being told to "move the button here, then there, no back there, actually get rid of it, hey where the fuck did that button go? Did you fuck up my UI?"

Do Java or C# if you want to constantly be fucking around with SQL tables and being told by your front-end team that the data's wrong even though you "fixed" it a thousand times.

Do C++ if you want to constantly be overlooked because you don't have 10 years in the industry and aren't an electrical engineer.

Robert Morgan
Robert Morgan

Do C++ if you want to constantly be overlooked because you don't have 10 years in the industry and aren't an electrical engineer.
sounds like C++ home free after 10 years kek

Noah Evans
Noah Evans

sorting algorithms count, r-right ?

Tyler Robinson
Tyler Robinson

If you got your first job in 2007, yeah.

Dylan Robinson
Dylan Robinson

std::split

std::split(container1.begin(), container1.end(), container2.begin(), []() ->bool {/*lambda;*/};

Alexander Jackson
Alexander Jackson

I'd say that's the threshold for being an actual programmer, if you can do them correctly and understand Big O. Still ground level, but you can make it.

Benjamin Martinez
Benjamin Martinez

How do you sort them? Alphabetically, by number of parameters, or by big-O efficiency.

Carter Hill
Carter Hill

So I figure most stick to java or python, maybe JS for entry level work, then move to C++ later on if they've been studying it during their off-time?

Nicholas Stewart
Nicholas Stewart

"hello world".split.writeln;

Grayson Miller
Grayson Miller

It's split.array.writeln

Nolan Morgan
Nolan Morgan

upvoted

Bentley Perry
Bentley Perry

I learned the hard way that big-O matter by running the same algo on a VM on my PC, vs on a dual core surface pro...

laptop took way longer to sort with insertion sort....

but with merge sort both were nearly same speed.

Tyler Davis
Tyler Davis

that's perfectly valid given the two missing imports and a main function.

Dylan Stewart
Dylan Stewart

/g/thread/63519107#p63521522
That is not exactly UB user.
It's true that he did not put \0 in the end and causing the puts() printing everything after the end of msg2.
But both msg2 and msg1 are stored on stack, and the behavior on stack is really predictable.

the specification of C didn't include how stack was done, and it's going to be really compiler depended,
but lots of compiler settle on the same way, so it's more like meta-behavior rather than UB.

Joseph Sanchez
Joseph Sanchez

I love this language so much! It's such a breath of fresh air!

Grayson White
Grayson White

It seems like entry level positions are often Java/C#/Python/JS

Which of these is also useful for everyday automation/hobbies?

Figure I'd kill two birds with one stone.

For example, if I want to make a program that automatically surfs/searches youtube, maybe even clicks elements inside a browser for me, and downloads a video, or analyze data, automate production of statistical graphics...

Which language is best for such projects?

Daniel Hall
Daniel Hall

why?

Kevin Watson
Kevin Watson

JS

Nathan Carter
Nathan Carter

All of them do, neither does it better than the other.

Even though, for what you want to do, I have Splinter in mind, and it's a Python framework.

https://splinter.readthedocs.io

Jaxson Jones
Jaxson Jones

Brad, Kees and Linus are performing an autistic shit smearing ritual and here I am, rocking my modern C++17.

Juan Garcia
Juan Garcia

Ok now try writing generics.

Colton Hughes
Colton Hughes

thanks famm

some JS frameworks a pretty cool

im torn I like the details of C, but JS/Python has such useful frameworks, you can do much more in fewer lines of code.

Julian Stewart
Julian Stewart

I like the details of C
Wait until you start hating details (aka using Rust)

Benjamin Gomez
Benjamin Gomez

using Rust
ever

jej

Luis Howard
Luis Howard

So, which one is it, /dpt/?
http://www.strawpoll.me/14467509

Brayden Allen
Brayden Allen

This is hardly generics, it's just overloading.

Charles Barnes
Charles Barnes

I'd use it over C

Austin Rogers
Austin Rogers

This is hardly generics
It seems to me like you can generate arbitrary expressions based on type, overload being just one use case.

Caleb Hughes
Caleb Hughes

Can I just use Expo to develop an android/iOS app fully or do I need to go through the effort of installing MacOS on VMWare to get access to Xcode?

Nathan Lewis
Nathan Lewis

Can you add more specializations without modifying the original lookup table?

Jaxson Murphy
Jaxson Murphy

Expo
?

Eli Edwards
Eli Edwards

You should just learn by building something you want to build.

Sitting there and reading a book about programming sounds terrible lol.

Adrian Edwards
Adrian Edwards

I'm afraid you legit need a mac to develop an ios app fully

Brandon Gutierrez
Brandon Gutierrez

Can you add more specializations without modifying the original lookup table?
I'm not sure. Maybe with some naming convention trickery, depending on what you're trying to achieve.

Christopher Jackson
Christopher Jackson

If you can't, it's rather useless. The point of ad hoc polymorphism with generics is to be able to plug in anything with special behaviour for the type, not choose from a limited set of types with predefined special behaviour.

Nicholas Hill
Nicholas Hill

If you can't, it's rather useless.
Perhaps for a really unimaginative mind.

Eli Howard
Eli Howard

If the set of types is restricted and defined ahead of time you gain nothing but a tiny bit of convenience over having multiple functions or whatever with different names.

Oliver Lopez
Oliver Lopez

Go(tm) fuck yourself

Jason Brooks
Jason Brooks

It's react native, but instead of using Xcode/Android emulation devices or adb devices, you use a client on your phone to visit the app compiled in JS, but you still develop it natively and can compile it

For which point? Compiling or publishing or something? I'd be fine using VMWare for that, but I'm just not keen using that for dev environment as it's using a shitty old adb android device I've got and Xcode emulator, so it's slow

Adam Stewart
Adam Stewart

How do you make IRC friends, lads? It seems that regulars really hate new people.

tfw can't make friends irl or online

Ryan Cox
Ryan Cox

Go get a /tg/ hobby.

Isaiah Thompson
Isaiah Thompson

i don't really have meaningful interactions with anyone and i'm not sure how to

Oliver Powell
Oliver Powell

You don't intrude on a tight knit circle of friends when you're not wanted.
Social cues apply online too.

Luis Young
Luis Young

Roleplay as a girl (female)

Anthony Robinson
Anthony Robinson

Thanks for the idea, but I'm not interested in RP stuff. I'm mainly talking about irc groups centered around tech.

Same, duder

That makes sense, I didn't really think about it that way. So what can I do, then? How do I get "involved" in a community?

Connor Russell
Connor Russell

I can be your friend

Ian King
Ian King

I'm too autistic for that

w<

Aaron Taylor
Aaron Taylor

I'm mainly talking about irc groups centered around tech.
literally just join one. Most will probably accept you assuming you don't treat it like Sup Forums. Which also is another problem in itself of having to censor yourself and be tied to an identity.

But /adv/.

Angel Sanchez
Angel Sanchez

https://github.com/torvalds/linux/pull/486

Anthony Watson
Anthony Watson

Too autistic or not autistic enough?

Cameron Murphy
Cameron Murphy

Let's be friends

William Rivera
William Rivera

I tried, but nobody really wants to talk to me
say hi
complete silence for half an hour
then a regular says hi
ten responses immediately

every fucking time

Jace Gray
Jace Gray

Why don't they just disable the issue tracker?
It's one checkmark away, they could avoid the 100 PRs a day from literal retards.

Austin Richardson
Austin Richardson

I'm not sure what you're expecting.
They know that guy.
They don't know you. Who the fuck are you?

Carter Gomez
Carter Gomez

How does this "socializing" stuff work?

Nolan Gomez
Nolan Gomez

Compare two things
"Hi"
or
"Hey guys, so I was playing around with this feature in $lang, not sure if I understand it properly. Example1, Example2. Can anyone have a look please?"
it's easy to break the ice with tech people

Kevin Bennett
Kevin Bennett

If you have to ask how to socialize at your age, it's too late for you.

It's like riding a bike, you learn when you're a kid
and if you're an adult who wants to learn, tough shit, you're way past the socially acceptable age to be using training wheels.

Tyler Murphy
Tyler Murphy

Let's all be friends and code together!

Chase Roberts
Chase Roberts

tfw you missed on teenage love

Jace Fisher
Jace Fisher

Am I a brainlet if I can't understand the tree recursive change making algorithm in SICP? I got everything up to that but I just can't get my head around this thing.

Jack Myers
Jack Myers

There must be something one can do

Jayden Richardson
Jayden Richardson

t. i don't know either

Andrew Anderson
Andrew Anderson

yeah
I hate programming a bit because I missed a lot of teen shit

Benjamin Davis
Benjamin Davis

you mean like fibonacci program

Joseph Gutierrez
Joseph Gutierrez

Go to a third world country, you'll get a lot of teen action legally

Jason Bennett
Jason Bennett

javascript was a mistake

Jaxon Green
Jaxon Green

Don't go to a third world country, they resent first worlders for being more fortunate, you won't be able to have a real relationship with anyone and anyone there who tells you otherwise is trying to scam you so they won't drop dead of hunger tomorrow

Ayden Martin
Ayden Martin

have a relationship
Check out this beta faggot

Carson Thomas
Carson Thomas

Beta and proud

Parker Roberts
Parker Roberts

oh well

Kayden Jenkins
Kayden Jenkins

I just wrote a self-balancing finger tree implementation in Julia, and used it to implement persistent vectors, hashmaps, and heaps.

I might make a github repo out of it and distribute it as a package at some point.

David Gutierrez
David Gutierrez

make a github repo out of it and distribute it as a package

not using email to distribute it
lel

Jaxon Ramirez
Jaxon Ramirez

on a device connected to the LAN to capture data from network

Austin Hall
Austin Hall

Learning Rust. The absence of function overloading bothers me.

struct NewsFlash {
headline: String,
author: String,
date: String,
}

struct Tweet {
tweet: String,
user: String,
}

trait Summarizable {
fn generateSummary(&self) -> String;
}

impl NewsFlash {
fn new(headline: String, author: String, date: String) -> NewsFlash
{
NewsFlash {
headline: headline,
author: author,
date: date,
}
}
}

impl Tweet {
fn new(tweet: String, user: String) -> Tweet
{
Tweet {
tweet: tweet,
user: user,
}
}
}

impl Summarizable for NewsFlash {
fn generateSummary(&self) -> String
{
format!(
"{} - {}({})",
self.headline,
self.author,
self.date,
)
}
}

impl Summarizable for Tweet {
fn generateSummary(&self) -> String
{
format!("{}: \"{}\"", self.user, self.tweet)
}
}

fn main()
{
let tweet = Tweet::new("RMS".into(), "Free the software.".into());
let news = NewsFlash::new(
"RMS calls for freedom.".into(),
"Staff reporter".into(),
"mm/dd/yy".into(),
);
println!("{}\n{}", tweet.generateSummary(), news.generateSummary());
}

Evan Williams
Evan Williams

Im wrote a simple program in netbeans this morning. There was a problem with the code and netbeans caught it.

I then try to remake the program in android studios. Made the same mistake that i made in the netbeans program but android studios didnt pick up on the problem. Why is this? The error was very minor so......

Blake Bell
Blake Bell

traits give you overloading

Ryder Brown
Ryder Brown

Android was a mistake

Ayden Young
Ayden Young

Can I overload the constructors to accept &str then? Can you demonstrate pls?

Evan Taylor
Evan Taylor

well im not ever gonna own an iphone so

Blake White
Blake White

reminder to compile gentoo for arm and install it on your phone and just go ahead and fucking clobber the partition scheme in the process who the fuck needs 16 fucking partitions or whatever ridiculous number it was android eterbally btfi

Julian Stewart
Julian Stewart

you'll have to ask a rustfag, but basically you could have something like (haskell syntax)

class ConstructsNewsFlash a where
newNewsFlash :: a -> NewsFlash

instance ConstructsNewsFlash (String, String, String) w here
newNewsFlash (headline, author, date) = ...
instance ConstructsNewsFlash NewsFlash where
newNewsFlash existingNewsFlash = existingNewsFlash

... etc

Jackson Jackson
Jackson Jackson

You can use Into<String>.

fn new<H, A, D>(headline: H, author: A, date: D) -> NewsFlash where
H: Into<String>,
A: Into<String>,
D: Into<String>
{
NewsFlash {
headline: headline.into(),
author: author.into(),
date: date.into()
}
}

Jaxon Nelson
Jaxon Nelson

stringly typed

Christopher Johnson
Christopher Johnson

Can't wait until mainline linux gets a GSM driver

Joshua Rogers
Joshua Rogers

What?

Dominic Sullivan
Dominic Sullivan

So what? Finish your sentence dingus?

Daniel Butler
Daniel Butler

even in asslel you can't have constructors without classes
roooooooooo

Jason Gonzalez
Jason Gonzalez

so why would i write something for it?

Dylan Gutierrez
Dylan Gutierrez

type classes aren't OOP classes
constructors are terrible

Ryder Adams
Ryder Adams

even if you dislike gnome you have to agree out of all the desktop environments it's the most adaptable to the mobile platform

also since typing on a phone is hard it would be cool to have a voice based terminal and/or one with token autocomplete

Brayden Taylor
Brayden Taylor

tfw your pull requests are being ignored

Gavin Jones
Gavin Jones

tfw your pull requests got ignored and maintainer copy/pastes your code in the next update as "some bugfixes"

Xavier Watson
Xavier Watson

type classes aren't OOP classes
they're kinds
they have functions associated to them with a block syntax
b--b--but they aren't OOP guise

constructors are terrible
writes constructors

Carter Brooks
Carter Brooks

Just do the same with their code.

Robert Gomez
Robert Gomez

they aren't kinds

Jace Hernandez
Jace Hernandez

id be fine with that i guess, as long as it helps the project

Isaiah Diaz
Isaiah Diaz

constructors
someone asked for them

associated functions
wow functions are totally more OOP than FP

block syntax
wow fucking OOP its not like every fucking language in the world has blocks and statements

Chase Johnson
Chase Johnson

branch first
commit changes to branch
merge request gets ignored
copy/paste
"some bug fixes"
comment with a link to your branch
"OH REALLY NOW"

Jeremiah Perez
Jeremiah Perez

associated functions
wow functions are totally more OOP than FP
block syntax
wow fucking OOP its not like every fucking language in the world has blocks and statements
it's the fact that the functions are IN the block syntax and the block syntax is prefixed with the definition of a typeclass and the functions operate on data of the type whose definition their containing block is a part of

Nathaniel Baker
Nathaniel Baker

Thanks

Anthony Kelly
Anthony Kelly

yeah yeah everything isOOP

Blake Anderson
Blake Anderson

OOP IS THE FUTURE OLD MAN

Joseph Martin
Joseph Martin

OOP is more useful than FP. That's why everyone uses OOP, and FP is DOA.

Luke Scott
Luke Scott

2/10

Jeremiah Morgan
Jeremiah Morgan

Face it if they hadn't been given the unfortunate name of typeclasses then your "it's OOP! really!" wouldn't have a leg to stand on.

Carter Ross
Carter Ross

Isn't the functional paradigm more modern than OOP?
heh I like a healthy mix of both

Brayden Gray
Brayden Gray

If everything is OOP then you'll never have to bother learning anything new - how convenient! I'm sure your Java skills will remain relevant for eternity

Josiah Morgan
Josiah Morgan

FUNCTIONAL OOP IS THE FUTURE OLD MAN

Christopher Lopez
Christopher Lopez

Session typed processes > objects

Luke Rivera
Luke Rivera

functional oop is an oxymoron. there's functional programming and dysfunctional programming, nothing in between.

Jayden Wood
Jayden Wood

reading doomsrc
im starting to understand why you guys loves diagrams so much

Aaron Hall
Aaron Hall

As a female programmer who got into it before the EVRY1 SHUD LERN 2 CODE! fad, I have to say that the resulting assumption that I got to where I am because of diversity quotas instead of hard work is dispiriting.

Nathaniel King
Nathaniel King

(female)

Carter Nguyen
Carter Nguyen

Post programming socks.

Benjamin Garcia
Benjamin Garcia

Threw away all my socks years ago.

Owen Cox
Owen Cox

as a twink who likes to wear stockings while I "program", which I learned last week from w3schools, I find the fact that no one will hire me (clearly because all the jobs are going to women and minorities) to be dispiriting

Tyler Long
Tyler Long

post feet

Oliver Howard
Oliver Howard

Also everybody keeps assuming I know JavaScript. I don't. I find the assumption offensive.

Connor Garcia
Connor Garcia

/lgbt/

Adrian Morgan
Adrian Morgan

if you have that much experience no one would think that you got in for diversity quota

Chase Lopez
Chase Lopez

Wrote a multithreaded program to find anagrams crazy fast --- 1.7 seconds to find all anagrams in a dictionary of 7 million words.

Leo Gutierrez
Leo Gutierrez

Holy shit this one actually fell for the trap meme

Samuel Johnson
Samuel Johnson

It tends to be younger programmers. The ones who think they're hot shit because they learned Java or Python instead of JS.

Carter Jones
Carter Jones

Y-You don't need multithreading

Caleb Russell
Caleb Russell

I bet you can still squeeze more speed out of your algorithm.
Write your own heap allocator to remove any costly kernel system calls and watch that speed rise.

Lincoln Wood
Lincoln Wood

woman posts in /dpt/ about negative effects of diversity quotas for minorities in tech who didn't benefit from them
other /dpt/ posters lose their minds

Ethan Stewart
Ethan Stewart

woman

Robert Lewis
Robert Lewis

Nobody's losing their minds.
It's distasteful to announce your gender, especially since it adds nothing to your post.
You're just looking for attention, post your bitch tits or fuck of..

Jackson Turner
Jackson Turner

[blog]Had an interview the other day for an internship, went decently (I think) but we'll see. Still got a couple options open, so my back's not against the wall yet.[/blog]
Alright, question time. I'm trying to handle memory management for the Scheme VM I'm writing, and I'm at a loss as to how to architect memory allocation at the byte level. Is it/should it be done on a per variable basis, or does the VM allocate a chunk for a bunch of different variables, say, inside a function and then let things go from there?
A big issue that I've run into trying to research the problem is that it seems a lot of the existing material out there assumes memory will be allocated in primarily fairly large chunks (never smaller than 1K or so) and not the handful of bytes that you'd see in a language where technically everything is assumed to exist in a heap.

If I figure the answer out I'll be sure to tell everyone else though. Maybe someone else is wondering the same thing.

Brayden Wright
Brayden Wright

"women"

Daniel Morris
Daniel Morris

i don't like working with other people because i'm smarter than them. are there any others here who do all the work at their company like me?

William Taylor
William Taylor

seriously laughing at all the people who learned useless languages in their degrees before unis switched to real world languages, one guy i met is doing a phd because he couldn't find a job using lisp or ml

Alexander Howard
Alexander Howard

who the fuck thinks they're hot shit because they learned java? on the other hand, if you know haskell or something that makes sense.

Kayden Smith
Kayden Smith

But it's ~3.5x faster with 4 threads and I'm autistic

I considered this, all my memory is malloced at the start of the program. I think it's going to be really hard to get anything more out of it, but it's possible.

Caleb Myers
Caleb Myers

Let's suppose for a second you ARE a woman and you actually DO think diversity drives are an actual real thing and they are a real problem.

I hate pushes for diversity because of how it makes me look
What a self-centered bitch you must be. No, it's not about people losing their jobs or about the quality of code going down, it's about people not seeing me as some sort of coding goddess for being a WOMAN who can CODE (because that's such a big deal, guys).

Get outa here, false flagger.

Asher Watson
Asher Watson

well, you'll probably end up getting promoted and forced to take on more responsibility.

Jaxson Cook
Jaxson Cook

Currently working on a set of scripts to help me administer my home server.

Jonathan Flores
Jonathan Flores

C# don't exists

Nathan Martin
Nathan Martin

it's the oldest paradigms in programming, i remember when OOP was the shiny new paradigm that everyone was going apeshit over as if it would change everything.

Leo Butler
Leo Butler

It's simple:
Real languages
C => Legacy language, the lowest common denominator that every modern language can FFI with, will never die for this
C++=> Lot nicer but a lot more pitfalls.
Rust => Not even a loli, has crazy mood swings. Stay away until it matures

Semi real:
D => Fine until you want real time performance
Nim => See Rust
Crystal => See Nim

Meme languages
_ => who cares

Logan Nelson
Logan Nelson

C# is dysfunctional trash. What, did you really think I hadn't ever heard of it? Of course I've heard of it. It's a slightly less shit Java. It's still terrible. Go back to school.

Oliver Allen
Oliver Allen

C# is no where near functional, rajesh. Go take your English classes first before shilling your literal botnet .NEET language ITT.

Thomas Hughes
Thomas Hughes

All languages are real.

Nolan Clark
Nolan Clark

suicide.

Owen Hill
Owen Hill

It's hilarious, some people seem to think that C# is the second coming. Blublets.

Lucas Miller
Lucas Miller

And all religion is true! No.

Benjamin White
Benjamin White

What's the best way to get good at Algorithms? Like best book, or best online courses. I need the meat and bones of it.

Owen Torres
Owen Torres

Your only life achievement is being a brainlet.

Aiden Peterson
Aiden Peterson

https://mitpress.mit.edu/books/introduction-algorithms

people swear by this book

Robert Young
Robert Young

Intro to Algorithms, 3rd Edition. You can find a PDF online for free, if you're too cheap to pay for it.

Oliver James
Oliver James

Much appreciated. I'll look into both. I'm sure I can just grab that free PDF

Jeremiah Johnson
Jeremiah Johnson

Just realized it's the same damn book.
But thanks, seems very popular.

Joseph Murphy
Joseph Murphy

How do I open two windows from two different structs using the GUI library in c++?
I have tried using callbacks but they haven't got me anywhere. I'm hesitant about showing my code since it has a lot of information.

Austin Scott
Austin Scott

Just a hunch, but I'm pretty sure C++ has more than one GUI library.

Caleb Lee
Caleb Lee

Wrote a Yelp clone in literally 3 days and had it hosted with over 300 registered users within a week.

Anyone who tells you web development is real programming, (or even worse, web-devs who call themselves ENGINEERS) need to be shot on sight. The shit is retard tier easy

var express = require('express');

and 50,000 lines of code are written for you LMAO

Luke Wood
Luke Wood

but the real question is
did you gain any money with it? |>3

Jose Bailey
Jose Bailey

Why do those structs need constructors? You should just _make_ the struct instead. That way you won't do something like mix up headline and user.

Isaiah Jenkins
Isaiah Jenkins

The fields are private. If your constructor starts to get unwieldly, it's common practice to use a builder.

Samuel Young
Samuel Young

/dpt/ eat a habanero NOW to increase your programming power.

Elijah Perry
Elijah Perry

how will you know

Gavin Sullivan
Gavin Sullivan

Difficult to monetize something when a much better known version of it is free

Evan Anderson
Evan Anderson

your metabolism will increase, you'll feel tingling and perspiration like after consuming caffeine

Christopher Clark
Christopher Clark

slightly less shit Java

yeah, you don't know shit about C#

Isaiah King
Isaiah King

is there any way to explicitly call destructor and constructor of an object in C++, other than copy paste the whole de- and constructor to a function?
Say, I need to reset the properties of an object, when something in the code fails, but only a single object, and the other part of the code should left untouched

Caleb Sullivan
Caleb Sullivan

how will you know if we eat one

Bentley Murphy
Bentley Murphy

I won't.

Julian Rodriguez
Julian Rodriguez

You're only cheating yourself if you pretend to eat one.

Ryder Adams
Ryder Adams

You can placement new on the memory address of the object.

thing t1;

new(&t1) thing;

You can just call the destructor.

t1.~thing1();

Logan Roberts
Logan Roberts

pomodoro technique

Jordan Evans
Jordan Evans

#include <iostream>

struct A {
A(int x) { std::cout << "hi, " << x << std::endl; }
~A() { std::cout << "bye" << std::endl; }
};

int main(void) {
// first init:
A some_a(3);
// re-initialize:
new (&some_a) A(4);
// manually destruct:
some_a.~A();

// (is implicitly destructed here)
}
/*
output:
hi, 3
hi, 4
bye
bye
*/

Note that this is horrible practice, and it is bad to do this if the A struct has any RAII objects (e.g. vectors, strings, file streams). Neither of these things should ever be done unless you are absolutely sure you know what you're doing.
If you just need to reset the fields of an object, just make a reset() method that gets called in the constructor. If you need to free things early, use managed pointers and have a function to reset them. For instance, unique_ptr has a reset() function that frees the object and safely sets the pointer the null (so that it won't be freed again by the implicit destructor call).

Aiden Thompson
Aiden Thompson

https://forums.somethingawful.com/showthread.php?threadid=3376083&pagenumber=518&perpage=40#post475472345

Ryder Turner
Ryder Turner

java/python/js isn't just for entry level work. i wouldn't be surprised if most webdevs stick with python or js for their entire career

Eli Morgan
Eli Morgan

hey, i have a fairly good understanding of the c programming computer language. ive made plenty of toy apps. how do i make a big projext though? how can i learn to make ia big projext?

Nolan Powell
Nolan Powell

java/python/js isn't just for entry level work
How lamentable.

Mason Walker
Mason Walker

Undeserved quints.
If you think that that feature is a suitable replacement for generics, you are conflating the meaning of "generic" and have no idea what generics mean in other languages.
This is just overloading, which is a pretty bad feature, as it usually makes it more difficult to reason about code just to save a few keystrokes.

Brody Stewart
Brody Stewart

you dont learn, you just do it.
97 refactors later youll shit something out and do it again with something else

Aaron Moore
Aaron Moore

What are some good books about actual program and codebase design? I find myself constantly writing shit.

Robert Hernandez
Robert Hernandez

could you explain what

 new (T*) T; 
does?
I never seen those usage of new

Jackson Howard
Jackson Howard

it depends on what you end up doing, but my job focuses on react and flask/django. some of the senior devs do some harder stuff, but it's still using python or javascript

Nathan Parker
Nathan Parker

It constructs the object at the given address instead of on the stack or heap at a new address.

Tyler Morris
Tyler Morris

so it call a constructor on a given address without calling malloc() to claim some heap?

Noah Ward
Noah Ward

his commit punchcard shows all his commits happen between 2-4am
he has multiple commits a day, all of them tiny trivial changes
he has an anime girl profile pic
he contributes to projects full of other users with anime profile pics
all of his projects revolve around viewing video or sorting anime pics or ricing their desktop
Absolutely nothing wrong with these, retard.

Julian Bailey
Julian Bailey

Please explain this. I am working on making an emulator and so i have been testing the speed of creating a 256x240 image and looping over each pixel and giving it a color. I specifically tested js using canvas(which i wrote my last emulator in) against c++ with sdl2. Obviously c++ is going to be several orders of magnitude faster than the "worst" scripting language in use today?
No.
Or, sometimes, but just barely.
I wrote code that looped over 600 frames (so 10 ingame seconds) and each frame it loops over each pixel and sets its color. c++ code:

high_resolution_clock::time_point t1 = high_resolution_clock::now();

for (int i = 0; i < 600; i++)
{
for (int x = 0; x < 256; x++)
{
for (int y = 0; y < 240; y++)
{
Uint8 *targetPixel = (Uint8*)screenSurface->pixels + y*screenSurface->pitch + x * 4;
*(Uint32 *)targetPixel = (i << 16) | (x << 8) | y;
}
}
SDL_UpdateWindowSurface(window);
}
high_resolution_clock::time_point t2 = high_resolution_clock::now();
std::cout << duration_cast<milliseconds>(t2 - t1).count();

js code:

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var data = ctx.getImageData(0, 0, 256, 240);
var t1 = Date.now();
for(var i = 0; i < 600; i++) {
for(var x = 0; x < 256; x++) {
for(var y = 0; y < 240; y++) {
data.data[x*4 + y*4*256] = i;
data.data[x*4 + y*4*256+1] = x;
data.data[x*4 + y*4*256+2] = y;
data.data[x*4 + y*4*256+3] = 255;
}
}
ctx.putImageData(data, 0, 0);
}
console.log(Date.now() - t1);

Can anyone tell me why both of these are taking 570-600ms? Like seriously is there no performance gain from being statically typed and compiled? Am i using sdl completely wrong? Is there a much faster way to manipulate the pixels?

Nolan Hughes
Nolan Hughes

More or less.

Ethan Sanders
Ethan Sanders

Three Rings for the Elven-kings under the sky,
Seven for the Dwarf-lords in halls of stone,
Nine for Mortal Men, doomed to die,
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
One Ring to rule them all, One Ring to find them,
One Ring to bring them all and in the darkness bind them.
In the Land of Mordor where the Shadows lie

Aaron King
Aaron King

lynda is the only good service for learning programming. every other one like udemy just offers shit courses for the most part. if you actually want to develop programming skills to a high level - which is important to mention because no other website offers as many good high-level courses that even experienced programmers can benefit from.

Nathan Nelson
Nathan Nelson

>>>/lt/

Jacob Foster
Jacob Foster

https://www.coursera.org/learn/learning-how-to-learn

the videos are a little cheesy sometimes, but the research they're based on is pretty solid and helped me immensely. this course will help you be less of a lazy distractable faggot and someone who can effectively go through the process of learning and master anything, let alone programming.

Leo Young
Leo Young

How do I make it easy for someone or myself downloading my repo to grab all the dependencies they need to build the project? I'm under the impression that you shouldn't be including them all in a lib folder or something in the repo, but there has to be a better way than adding a readme or something and listing everything the person needs in it. It's a c++ project if that matters, and I'm not using an IDE or anything.

Jacob Lopez
Jacob Lopez

time to write some ui elements
how hard can it be

Carter Nelson
Carter Nelson

i wrote my first android app today

to see if i still bleed

Isaiah Peterson
Isaiah Peterson

>>>/wdg/

Joseph Martinez
Joseph Martinez

Better be immediate mode.

Andrew Powell
Andrew Powell

i was wondering that when you make a hello world, is your computer saying hello world of it's own volition? how do you make a program that actually decides to say hello world because it wants to (like a human does) instead of a hardcoded command?

Caleb Brown
Caleb Brown

try to see what the difference is when you increase the resolution

Gavin Bell
Gavin Bell

how many rings did programmers get

Nathaniel Allen
Nathaniel Allen

You could write some deep learning albert go-rhythm to only output hello world on some given conditions, which is still somewhat hardcoded

Gabriel Wood
Gabriel Wood

link us your github then, you cancerous faggot.

Easton Foster
Easton Foster

Since noone is pointing out any glaring issues with my c++ i have to assume it actually is just a meme language, you get similar performance in fuckings js. I'm honestly pretty shocked.

Jace Richardson
Jace Richardson

Why the fuck would I post my github here, you nigger.

Brandon Rivera
Brandon Rivera

Because 95% of Sup Forums uses are spineless brainless NEET retards who can't do anything malicious with a github link?

Isaiah Moore
Isaiah Moore

ill try

Adrian Moore
Adrian Moore

i think it's pretty fucking obvious to us. now fuck off or post your github.

Xavier Gray
Xavier Gray

My guess is that SDL_UpdateWindowSurface is more expensive than putImageData.

Thomas White
Thomas White

interesting, tell me more? i'm interested in understanding the principles of ML.

Dominic Edwards
Dominic Edwards

I've been seeing a lot of people shilling Julia lately.

Is this representative of something or is it only a trend on Sup Forums?

Blake Anderson
Blake Anderson

your c++ is software rendering, canvas in javascript is hardware accelerated assuming you have it turned on. also, don't forget to turn on optimizations

Bentley Mitchell
Bentley Mitchell

You would think that the JS version would be way slower, then, because it's doing 600 CPU to GPU uploads.

Gavin Sanchez
Gavin Sanchez

any faggots here working in:

1)boston
2)vancouver
3)toronto

can you tell me what PLs are most job openings based on in the area?

Jace Lee
Jace Lee

SDL_UpdateWindowSurface(window);

is rather expensive, so doing this 600 times is going to be slow.

Jeremiah Rivera
Jeremiah Rivera

how does free() knows the size of the memory being released?

Aaron Jenkins
Aaron Jenkins

I hate pushes for diversity because of how it makes me look

Literally not what she said. Maybe check your reading comprehension:

[I hate pushes for diversity because it] is dispiriting.

It is relevant to what she said because if she were not a woman, it would not be dispiriting.

You fucking aspies do not understand that in the real world qualified people voluntarily choose to leave themselves out of the programming talent pool because of *muh feels*. Not that this person in particular is going to stop programming just because they feel "dispirited", but if programming perpetually makes you feel like shit because of social factors, you might choose to find a new occupation. If you want to make the programming talent pool as large as possible you need to consider how different people feel about programming as a profession, but this isn't going to happen because Sup Forums would like to remain in an autistic utopia where people do not make decisions based on emotion.

Liam Bennett
Liam Bennett

where does recaptcha verification get all the images from, and how does it know what squares actually have the thing it's asking for?

Isaac Rodriguez
Isaac Rodriguez

information kept by the underlying heap allocator

Logan Adams
Logan Adams

not only on Sup Forums, big organizations are also going all in for it. how long this trend will last i can't say, but it might be worth capitalizing on in the short term.

Justin Moore
Justin Moore

she

Dominic Ramirez
Dominic Ramirez

Then what happened if free() receive a pointer that not point to the start of a memory because of pointer arithmatic?
example:

char * a = malloc(10);
*a = 5;
a++;
*a = 3;
free(a);

Joshua Sanders
Joshua Sanders

what is julia been sides the name of my crush?

Justin Adams
Justin Adams

software rendering being faster than gpu rendering is new to me but if that's what you want to believe go for it

Grayson Lee
Grayson Lee

If you do that, anything could happen, probably something bad will happen. It's "undefined behavior"

Julia seems really neat but it isn't useful for what I do. It's probably just 2 or so anons shilling it.

Robert Scott
Robert Scott

You don't seem to understand how it works. Massively parallel tasks are generally faster on the GPU, but there is a lot of latency involved in copying memory between the CPU and GPU. In this example, the only operation is copying from the CPU to the GPU, no shaders are run.

Aaron Miller
Aaron Miller

Like that but it gives the amount of ways you can make change for the input number so like 10 would give 4

Jordan Ortiz
Jordan Ortiz

Why on earth do people consider C to be a good language for learning? Beginners make mistakes, that's what makes you a beginner. In C, when you make a mistake, it might crash with a useless message, it might continue running, or it might do something insane. None of these results are helpful to a beginner in any way.

Camden Howard
Camden Howard

because they do that in universities. you think you know better than university professors?

Joshua Smith
Joshua Smith

My university professors despise C; I think they know very well.

Nathaniel Cook
Nathaniel Cook

C to be a good language for learning

means "Learn C when you are not learning anymore"
implying people didn't learn a new thing when they already know something
So, when are you not learning anymore, user?

Andrew Foster
Andrew Foster

despise C

Joseph Clark
Joseph Clark

Universities are a joke at the undergraduate level.

Daniel Morris
Daniel Morris

I tried with 1024x1024 resolution. Now js is quite a bit faster. JS used 26950ms while c++ used 29320.
But as others have said i guess it's not as fair of a test as i thought. JS ofcourse only updates the screen once while c++ sdl updates the window every time updateWindowSurface is called. However i am unsure how much this affects performance.
Others have pointed out that sdl is not hardware accelerated while js running in my browser is. This is another point that i did not take into account.
If anyone have any suggestions on how to make the test more fair id love to hear them. I could do a requestAnimationFrame in js and actually render out the canvas each update like in c++ but that would be unfair to js since it would have to render the rest of the dom and process many other events too.
Hmm...

Lucas Jones
Lucas Jones

I have to assume it actually is just a meme language, you get similar performance in fucking js

You don’t. You have a bottleneck somewhere. Go profile your code.

Asher Rogers
Asher Rogers

I could do a requestAnimationFrame in js and actually render out the canvas each update like in c++ but that would be unfair to js since it would have to render the rest of the dom and process many other events too
That wouldn't be unfair to JS. In an emulator you would have to do that once per frame the same way you have to update your SDL window once per frame.

Samuel Rivera
Samuel Rivera

Did another test with i = 1 i.e only rendering 1 frame to remove the js advantage of only rendering once while c++ renders all 600 frames. js consistently uses 60-64ms while c++ uses 50-53ms.

Joshua Reed
Joshua Reed

With running times that low, results are generally meaningless due to timer inaccuracy. A decent test would be writing the image many times (and blitting in SDL), updating the window/browser, and repeating the whole thing many times.

Austin Taylor
Austin Taylor

All POO memes aside, is JavaFX a good platform for cross-platform GUI development? I'm looking at the available options, and it seems that JavaFX is the best combo of well-supported, well-documented, and modern. I wouldn't particularly mind working in Java if JavaFX is good.

To the anons here who have used JavaFX, how was your experience?

Zachary Anderson
Zachary Anderson

That one gave me trouble too. All I can really say is to read this part carefully and see how it is implemented in the code there, and how it will continuously be implemented and break the problem apart (by means of # of coins and amount) and down (by decreasing each) further until it reaches one of the end conditions. I found some other explanations through google that helped a bit too.

Carter Nelson
Carter Nelson

JavaFX and Swing are both fine libraries.

Julian Clark
Julian Clark

I've used Swing before, it's pretty good imo. How does it compare to JavaFX?

Jace Adams
Jace Adams

is swing really acceptable? i did it for a school project and the shit looks ugly

Luis Jenkins
Luis Jenkins

The only thing Julia has is fake benchmarks.

Henry Hill
Henry Hill

Yeah, it's pretty ugly. Someone in my software engineering course made a whole digital circuits simulator in Swing and everyone laughed at their group because it looked atrocious, but it got the job done and requires no whacky dependencies

Logan Moore
Logan Moore

Do somebody knows if is possible to sniff packets from wifi via eth?
i have a raspberry pi 1 model B i don't use so i want to capture all the images from the network

Adrian Sanders
Adrian Sanders

hey, can any kindly /dpt/ anons check this video and see if it is legit?

https://youtu.be/077FVwZ1mlE

a lot of people claiming that you can self-learn programming, even though i think the best choice for actually learning programming and getting a good job is university CS degree.

if i understand it correctly, i think /dpt/ tends to recommend CS degrees rather than self-learning. i don't remember there being very many self-learners here.

Hudson Gutierrez
Hudson Gutierrez

Explain.

Carter Morgan
Carter Morgan

Given a choice between a self-learner and someone with a CS degree, most employers will take the person with the CS degree.

Dominic Gutierrez
Dominic Gutierrez

What about people with Math or Physics degrees?

Evan Collins
Evan Collins

https://danluu.com/julialang/

Since I’m talking about issues where I care a lot more than the core devs, there’s also benchmarking. The website shows off some impressive sounding speedup numbers over other languages. But they’re all benchmarks that are pretty far from real workloads. Even if you have a strong background in workload characterization and systems architecture (computer architecture, not software architecture), it’s difficult to generalize performance results on anything resembling real workload from microbenchmark numbers. From what I’ve heard, performance optimization of Julia is done from a larger set of similar benchmarks, which has problems for all of the same reasons. Julia is actually pretty fast, but this sort of ad hoc benchmarking basically guarantees that performance is being left on the table. Moreover, the benchmarks are written in a way that stacks the deck against other languages. People from other language communities often get rebuffed when they submit PRs to rewrite the benchmarks in their languages idiomatically. The Julia website claims that “all of the benchmarks are written to test the performance of specific algorithms, expressed in a reasonable idiom”, and that making adjustments that are idiomatic for specific languages would be unfair. However, if you look at the Julia code, you’ll notice that they’re written in a way to avoid doing one of a number of things that would crater performance. If you follow the mailing list, you’ll see that there are quite a few intuitive ways to write Julia code that has very bad performance. The Julia benchmarks avoid those pitfalls, but the code for other languages isn’t written with anywhere near that care; in fact, it’s just the opposite.

Zachary Butler
Zachary Butler

Not sure. The degree is probably still preferable.

Chase Allen
Chase Allen

Math and Physics are very desired degrees for CS jobs. Basically, any undergrad degree with lots of math and a high dropout rate is great because it demonstrates that you're capable of critical thinking and grinding through 4 years of hard shit.

Brayden Martinez
Brayden Martinez

forget about getting a job for a second, i'm more talking about just learning programming. i don't think self-learning is the way to go personally. obviously job is easier with degree, but the learning programming part is best done at university.

Benjamin Rodriguez
Benjamin Rodriguez

You need both. A CS degree to get a job, and being able to self-learn to keep the job.

Ryan Ortiz
Ryan Ortiz

It's extremely possible to get a software job without a degree. But you'll have to have some way of proving your software knowledge and that's not going to be easy. It's also not easy for most people to have the discipline and frame of mind in order to self-learn.

Above all don't expect it to be easier to learn coding on your own. Cheaper, possibly, but a structured learning environment is better for 99% of learners.

Thomas Brooks
Thomas Brooks

That's a three year old post, from someone who obviously had an axe to grind.

For the other side of the story, I'd suggest taking a look at this hackernews thread: https://news.ycombinator.com/item?id=11073223

Brody Rodriguez
Brody Rodriguez

Basically, any undergrad degree with lots of math and a high dropout rate is great because it demonstrates that you're capable of critical thinking and grinding through 4 years of hard shit.
are you fucking sure about this? employers does not see it that way.
that or im being turbo autistic in interviews.

Brody Gonzalez
Brody Gonzalez

since you're autistic just claim you're generfluid or some shit then you will fill the diversity quota and can do fuck all at the job

Samuel Campbell
Samuel Campbell

someone who obviously had an axe to grind
I'd suggest taking a look at this hackernews thread (in which one of the co-creators of Julia is busy shilling)
oh look, another shill

Robert Hernandez
Robert Hernandez

Are callback functions in C++ idiomatic?

Carson Cruz
Carson Cruz

No. Use std::function

Jackson Roberts
Jackson Roberts

Well yes, the post by the creator that danluu had an issue with was what I was pointing to.

Danluu claims that he was somehow treated underhandedly, but looking at the actual post that he was angry at, it looks perfectly calm and reasonable. He was the guy who deleted all his replies.

Xavier Watson
Xavier Watson

while( !quit )
{
//Handle events on queue
while( SDL_PollEvent( &e ) != 0 )
{
//User requests quit
if( e.type == SDL_QUIT )
{
quit = true;
}
}

//Clear screen
SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
SDL_RenderClear( gRenderer );

//Render red filled quad
SDL_Rect fillRect = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT};
SDL_SetRenderDrawColor( gRenderer, fillRectColor.r, fillRectColor.g, fillRectColor.b, fillRectColor.a );
SDL_RenderFillRect( gRenderer, &fillRect );

//Render green outlined quad
SDL_Rect outlineRect = { SCREEN_WIDTH / 6, SCREEN_HEIGHT / 6, SCREEN_WIDTH * 2 / 3, SCREEN_HEIGHT * 2 / 3 };
SDL_SetRenderDrawColor( gRenderer, 0x00, 0xFF, 0x00, 0xFF );
SDL_RenderDrawRect( gRenderer, &outlineRect );

//Draw blue horizontal line
SDL_SetRenderDrawColor( gRenderer, 0x00, 0x00, 0xFF, 0xFF );
SDL_RenderDrawLine( gRenderer, 0, SCREEN_HEIGHT / 2, SCREEN_WIDTH, SCREEN_HEIGHT / 2 );

//Draw vertical line of yellow dots
SDL_SetRenderDrawColor( gRenderer, 0xFF, 0xFF, 0x00, 0xFF );
for( int i = 0; i < SCREEN_HEIGHT; i += 4 )
{
SDL_RenderDrawPoint( gRenderer, SCREEN_WIDTH / 2, i );
}

//Update screen
SDL_RenderPresent( gRenderer );
fillRectColor.r += 1;
fillRectColor.g += 2;
fillRectColor.b *= 2;
++frameCount;
if(frameCount % 1000 == 0){
auto end = std::chrono::steady_clock::now();
auto elapsed = end -start;
auto dur = std::chrono::duration_cast<std::chrono::milliseconds>(elapsed);
std::cout << dur.count() << "ms / 1k frames" << std::endl;
start = std::chrono::steady_clock::now();
}
}

you should read a tutorial on how to use sdl. i'm running this slightly modified tuturoial code at 640*480 in a virtual machine and i'm getting 250ms/1k frames.

js competing with sdl
lmao my dude

Zachary Collins
Zachary Collins

when all you know is js everything looks like a webapp

Nolan Campbell
Nolan Campbell

You're just an autist dude. What was your major? Are you in the U.S.? Defense contractors within the U.S. eat up Math/Physics majors like candy for programming jobs.

Gabriel Sullivan
Gabriel Sullivan

Can someone explain - why do people make a big deal out of memory management in C++? All the programmers coming from other languages make it seem like the equivalent of colonizing Mars, whereas in reality you can learn it in an afternoon. Particularly with smart pointers.

Evan Garcia
Evan Garcia

1) You really should learn to shaders if you're trying to do something like that.
2) V8's actually pretty amazing. It's not uncommon for it to match and, in very corner cases, even surpass compiled C++ code for simple things. What really kills it is unnecessary data conversions and shitty design practices revolving around coders who obsessively use nested anonymous functions for every damn thing resulting in lists of lists being re-allocated to lists of functions on lists, etc etc when simple for loops would have worked.

Nolan Young
Nolan Young

Because other languages hold your hands and people fresh to non-garbage collected memory patterns have a hard time adjusting to the change in responsibility.

Aiden Moore
Aiden Moore

Daily reminder that even Go shills realize that their language somehow manages to be even worse than node.js for its intended application, servers.

https://github.com/maxpert/raspchat/releases/tag/v1.0.0-alpha

Daniel Ross
Daniel Ross

Because you occasionally screw up.

C doesn't hold your hand, you have to learn how to clean up memory. You get scratched occasionally but you pick up the skills naturally.

GC'ed languages always hold your hand and you never have to worry.

C++ holds your hand until it suddenly yanks your whole arm off. At that point you have weird action at a distance and have no idea what to do or where it comes from.

Hunter Thompson
Hunter Thompson

Hatred of memory management doesn't come from its complexity (in fact almost the opposite), it comes from its unsafeness. As much as you're gonna say "well just don't fuck up", it's going to happen unless you rigidly follow RAII principals and even then you can easily miss a delete when refactoring.

And if you're using smart pointers you're not really doing oldschool memory management. You're using something similar but not identical to Garbage Collection (and has its pros and cons against it). Not that that's bad (quite the contrary) but it's not the kind of "memory management" that Java is religiously opposed to.

Jace Harris
Jace Harris

Yeah, at the smart pointer level you're (probably) doing reference counting, which is a form of garbage collection anyway.
It's easy to say manual memory management is easy until you code a large-scale project and have no idea where your memory leaks come from. Projects like Valgrind exist for a reason.

Hunter Stewart
Hunter Stewart

Smart pointers as a replacement for GC.

Not this shit again. Unique_Ptr is not a replacement for GC, it's just a boxed value which is collected as it falls out of scope and would be collected the same way in some GCed languages if it's deemed efficient.

So the thing that really replaces GC is refcounting. This has been shown many times to be considerably less efficient than an optimized tracing GC.

https://news.ycombinator.com/item?id=11759762

A naive C++ program where you just replace GC with shared_ptr will be slow. The way you make C++ code fast is not by blindly putting everything in smart pointers, but by actually knowing what you are doing. Got a lot of small objects of the same size? Allocating them with malloc/free will be slower than in a GCed heap. So you allocate them in a pool instead, which works for your particular case and is much more efficient than a GCed heap.

Basically, knowing smart pointers does not equal knowing how to manage memory, it is just a first step to writing a correct C++ program.

Cameron Anderson
Cameron Anderson

Smart pointers as a replacement for GC
You literally came up with that line from your own ass.

Carter Nguyen
Carter Nguyen

Next thread:
/g/thread/63527792#p63527792
/g/thread/63527792#p63527792
/g/thread/63527792#p63527792

Ayden Taylor
Ayden Taylor

i love my waifu
uwu

Lucas Rogers
Lucas Rogers

Actual new thread that hopefully won't get deleted:
/g/thread/63527989#p63527989
/g/thread/63527989#p63527989
/g/thread/63527989#p63527989

Samuel Roberts
Samuel Roberts

This is not doing even close to what i was. I was manually setting 256x240 pixels to unique colors every frame.

Justin Ross
Justin Ross

Scheme is the best programming language
Chicken is the best dialect of it
Emacs is the best editor for it
GNU/Linux is the best OS for it
POWER9 is the best architecture for it

Jeremiah Clark
Jeremiah Clark

std::function should be avoided.
Use generics or function pointers whenever possible.

Yes, lambda predicates are common, especially in <algorithm>

Jason Cox
Jason Cox

How do you call a window within a callback function? I'm using the FLTK toolkit from c++ to perform this.
I already have my classes and callback set up. I have manged to close one already using hide() but I don't know what to do to open another window. show() doesn't work for me. I have created a mock code to convey what problem I am having.

struct window_one:Grahph_lib::Window
//code is typed here
struct window_two:Grahph_lib::Window
//code is type here
window_one::cb_next_window(Address, Address pw)
{
reference_to<window_one>(pw).next_window();
reference_to<window_two>(pw).show();

}
void splash_screen::next_window()
{
hide();

}
#include "GUI.h"

int main ()
try
{
window_one win(...);
return gui_main(); // an “infinite loop”
window_two win2(...);
return gui_main();
}

catch (exception& e) {
cerr << "exception: " << e.what() << endl;
keep_window_open();
}
catch (...) {
cerr << "exception\n";
keep_window_open();
}

Joseph Gomez
Joseph Gomez

Only JS can build a stable and fast full stack (node.js) web application that is quick and easy to build with endless opensource code to copy from.
C is for sperglords. C# is a pain. Java is laggy and a massive time sink.

Disable AdBlock to view this page

Disable AdBlock to view this page