/dpt/ - Daily Programming Thread

Adrian Roberts
Adrian Roberts

Old: credforums.com/thread/56885896/technology
Working on?

All urls found in this thread:

credforums.com/thread/56885896/technology
pastebin.com/ZpZrknwv
docs.oracle.com/javase/tutorial/deployment/jar/update.html
pastebin.com/LWgASthk
developer.mozilla.org/en-US/docs/Web/API/ImageData
strawpoll.me/11351129/
numpy.org/
impredicative.com/ur/
learnyouahaskell.com/chapters
amazon.com/C-Programming-Modern-Approach-2nd/dp/0393979504
cplusplus.com/reference/fstream/ifstream/open/
www196.lunapic.com/editor/?action=retro&redo=1&color=retro),
youtu.be/g7entxbQOCc
msdn.microsoft.com/en-us/library/c8whxhf1.aspx
credforums.com/thread/56896846/technology

Dylan James
Dylan James

First for D

Jose Jones
Jose Jones

i'm amazed by how smart that man was

Dominic Sanders
Dominic Sanders

Why isn't this board at a 500 post bump limit?

Other boards that post hundreds of hq images get the same limit as us.

Hunter Gutierrez
Hunter Gutierrez

Why do ppl hate functional programming? Just starting it and it's dank as fuck nigger

Nicholas Wilson
Nicholas Wilson

He was smart in maths but in computer science he's a fraud.

Carter Murphy
Carter Murphy

It challenges their cult

Cooper Roberts
Cooper Roberts

pastebin.com/ZpZrknwv

Been trying to figure out what's so terrible about JS during the weekend - I think I've got it!

Anyway, general critique welcome - if you can be bothered, try raising the dimension variable, my browser crashes at 100 but my system is no good.

Levi Fisher
Levi Fisher

credforums.com/thread/56885896/technology
- YOU DON'T TRY TO FIT IT INTO OBJECTS -
Yes you do. In an object oriented language.

See credforums.com/thread/56885896/technology

credforums.com/thread/56885896/technology
The cornerstone of OOP is that everything inherits from the Object class.

credforums.com/thread/56885896/technology
It depends on how functional you want to be. If you're a purist even IO is difficult.

Dylan Cook
Dylan Cook

Yes you do. In an object oriented language.
Object orientation is the fucking problem

Caleb Jones
Caleb Jones

about to start a silly project for shits and giggles, has anybody ever made a program to braid git trees by branching/merging strategically?

Cameron Williams
Cameron Williams

How can I make netbeans/maven actually package all of the files required to make a jar runnable directly into the .jar? Apparently, the maven jar plugin and the maven dependency plugin don't actually package the classes that YOU made into the jar.

Charles Powell
Charles Powell

Does that thing have any specific name?

Michael Perry
Michael Perry

If you're a purist even IO is difficult.
Nah.

Jordan Garcia
Jordan Garcia

It's a forest! The red dots are lumber jacks. I think I'll add bears as a form of predator.

Carson Sanders
Carson Sanders

Oh I thought it was some sort of a programming challenge that has a name and rules (like Conway's Game of Life etc).

Ryan Parker
Ryan Parker

I guess you are the world's leading authority on language design then?

Christopher Edwards
Christopher Edwards

On a more related note, I got it running with dimension set to 500 but each step takes like 5 seconds~.

Xavier Cruz
Xavier Cruz

Jesus christ
Why can't you acknowledge that maybe, perhaps, trying to fucking make everything about objects and inheritance might not be a good idea?

Ayden Barnes
Ayden Barnes

Wow, those are some fast growing trees.

Joshua Kelly
Joshua Kelly

No I don't think so! I just enjoy making something with a visual output when learning something new.

Jason Sanchez
Jason Sanchez

Because you're acting all retarded.

Cameron Wright
Cameron Wright

You've already said that you think it's not a bad idea to take a solution and try and make it about objects

Robert Wright
Robert Wright

I'm able to do 500 at a seccond per step.
Why don't you render it into a canvas?

Nicholas Bailey
Nicholas Bailey

Why can't you acknowledge that maybe, perhaps, trying to fucking make everything about objects and inheritance might not be a good idea?
It is a good idea in the context of programming in an object oriented language. In fact you are forced to do that then.

You are acting like I claimed OOP is the best approach to solving any problem.
I have never claimed that, and I know for a fact there are domains where other paradigms outshine OOP completely.

See my first point. Also you're arguing with multiple people.

Connor Price
Connor Price

It is a good idea in the context of programming in an object oriented language. In fact you are forced to do that then.
That's why I said object orientation is the problem.
It's not a good idea.
That means that either there's something wrong with the language, or that's not what the language is designed for.

Zachary Gutierrez
Zachary Gutierrez

If functional programming is so good then why hasn't it caught on?

James Lewis
James Lewis

It is catching on right now

Carson Davis
Carson Davis

canvas
Good idea I'll try that!

Jacob Thompson
Jacob Thompson

tfw too dumb for functional programming

Hudson Turner
Hudson Turner

Cred Forums != the world

Wyatt Gray
Wyatt Gray

Where?

Xavier Collins
Xavier Collins

it's not too hard for you

just start writing some higher order functions

lambdas, linq, tuples/"multiple return values", more higher order functions being used, variants, pattern matching, more descriptive types
what was the last major OOP feature added to a major language

Chase Jenkins
Chase Jenkins

I'm able to do 500 at a seccond per step.

Neat, I'm running it on a Pentium so go figure but I just wanted to see if I can get a higher number since the original poster mentioned it crashes at 100 for him.

Daniel Lee
Daniel Lee

Useful features != the paradigm

Jace Russell
Jace Russell

and meanwhile

don't use inheritance
try not to hide mutable state
etc

Yes, if you adopt the paradigm that's not the same as adopting the paradigm
Jesus

Hudson Nguyen
Hudson Nguyen

Basically you're saying that FP is becoming just another whore in the procedural whorehouse. Abandoning its purity and other nonsense.

Brody Nelson
Brody Nelson

Which is a good thing, though, because functional features are so fucking good.

Adam Torres
Adam Torres

FP isn't inherently pure, I think purity is good for languages, especially so in FP, but the majority of FP has been impure

Imperative languages are starting to control effects - constexpr, @pure, adding exceptions to the type system

basically when i was bitching about the "visitor pattern" earlier
literally just replace that with a higher order function

William Hernandez
William Hernandez

in fact almost any case of inheritance can be practically replaced with higher order functions

Colton Rivera
Colton Rivera

If functional programming languages are so good then why haven't they caught on?

Jordan Scott
Jordan Scott

You know what meme I really want? HKTs.

Isaiah Jones
Isaiah Jones

HKTs are pretty good, I don't know how C# implements generics but if you do them right you could get polymorphic recursion

what you really want is haskell style do notation

John Morgan
John Morgan

Because it's very fucking hard for any new language to gain mainstream usage.

Also many mainstream langugaes are gaining functional features making the draw to primarily functional langugaes less strong.

Zachary Torres
Zachary Torres

They're fun for hobbyists and jerking off to pretty code but that's it.

Jack Thompson
Jack Thompson

Higher Kinded Types? What are those again?

Robert Perez
Robert Perez

you can parametrise a type or type constructor over another type constructor, e.g. template template parameters in C++

so you could implement traverse, for instance

Nicholas Barnes
Nicholas Barnes

its too hard for Pajeet and Stacey

Robert Murphy
Robert Murphy

Automating the network
Building a REST API for DNS info in LDAP

Evan Green
Evan Green

Problem is there's no CLR support for HKTs, so there'd have to major changes, or they'd have to be hacked in.

I'd prefer the former, because we know what happens when essential language features are hacks (see: Java).

Michael Wood
Michael Wood

Then maybe they aren't that good.

Brayden Martin
Brayden Martin

Is that the same as dependant types?

Noah Bennett
Noah Bennett

whoops, mapM was the one in the pic

no, dependent types lets you paremetrise types over terms/values

Logan Cooper
Logan Cooper

Why couldn't they just add them to the CLR? They add shit to the CLR all the time. it's not backwards compatible like Java is.

William Walker
William Walker

Why couldn't they just add them to the CLR?

I don't know, but the last time someone proposed it, it got shot down.

Isaac Adams
Isaac Adams

no, dependent types lets you paremetrise types over terms/values
hmm? Can you give me a small example of both?

Kayden Barnes
Kayden Barnes

dependent types:

replicate :: forall a. (x :: Integer) -> a -> Vect x a
-- the return type includes a term, x

higher kinded types:

type ApplyInteger (c :: * -> *) = c Integer
data Set a = ...
type IntSet = ApplyInteger Set
-- set isn't a type, it's a type constructor like a generic or something
-- but we can still use it as a parameter

Jack Gutierrez
Jack Gutierrez

still don;t really get it...

"Set a" is a type constructor? How is IntSet a type is it's defined partly by Set a that isn't a type? I don;t quite follow

Lucas Hernandez
Lucas Hernandez

How the hell do you learn javascript?
I do C and C++, I can't understand javascript, is it even programming? What is it for? Why are there so many jobs that list it as a requirement?

Camden Cox
Camden Cox

I've been trying to edit a library
I've edited ParticleSystem.java (circled in pic related)
When I add the edit library back in, the new methods that I create are not recognised.

Should I be editing ParticleSystem.class instead?

I can fully delete ParticleSystem.java, and I get no errors when running my program, whereas I get errors if I delete ParticleSystem.class, so it must be ParticleSystem.class that's being read, not the .java

How does this work? I'm very confused what's happening in the JVM.

Justin Gomez
Justin Gomez

are you editing a jar file?

stop doing that

Brayden Taylor
Brayden Taylor

It's needed for websites user. Lots of people want websites.

Angel James
Angel James

Set is a type constructor, and a is a type parameter for Set
think
template <typename a>
Set { ... }

so
applyInteger<set> = Set<Integer>
applyInteger<vector> = Vector<Integer>

but that's obviously a silly example, you can do more stuff like say you can write a function that works with any generic container, e.g.

template <template <typename> typename c, typename a>
c<a> clear(c<a>);

Isaac Gomez
Isaac Gomez

How the hell do you learn javascript?

Step 1:
Write your code in Java
Step 2:
Delete any syntax or words that look confusing

Compile flawlessly

Oliver Thompson
Oliver Thompson

I used 7-zip to get the contents of the .jar out.

When I export it as a .jar, it has the exact same functionality that it did before.

There's nothing wrong with this, as far as I know. I haven't had to decompile anything.

Jacob Roberts
Jacob Roberts

Why are there so many jobs that list it as a requirement?
... he typed into the javascript form.

Joseph Russell
Joseph Russell

docs.oracle.com/javase/tutorial/deployment/jar/update.html

Liam Thomas
Liam Thomas

advanced mathematics is hard for most people so it isn't good

Luis Morris
Luis Morris

What should I work on? I want to do something sciencey. My last project was genetic algorithms

John Moore
John Moore

it's too hard for stupid people
it must be shit

Brayden Johnson
Brayden Johnson

most of these jobs are for server-side applications, i.e., node.js

Xavier Powell
Xavier Powell

Haskell is older than Python, Ruby, and C#

Jaxon King
Jaxon King

I like programming in Visual Studio and NetBeans, and they are my go-to IDEs.

Is there any language out there that Eclipse can handle that either of the other two can't? I never really cared for it, so I'm thinking of getting rid of it.

Caleb Long
Caleb Long

test the checksums of the updated file and the file in the jar. if they truly are the same, it might be some weird shit with the jar metadata

Angel Kelly
Angel Kelly

Is there any language out there that Eclipse can handle that either of the other two can't?
If there is, it's not worth using.

The only good thing about using node and noSQL is that your objects look the same on server, in the database and in the client. That's actually very convenient. The only problem is that clients are restricted to javascript, a poorly designed language overall.

Adrian Baker
Adrian Baker

using an IDE
Do you use a fisher price "my first computer" too?

Matthew Carter
Matthew Carter

Is that wrong?

Gavin Lopez
Gavin Lopez

That's what I thought too, thanks for the confirmation. Godspeed.

I don't need your besserwisser shit, Cred Forumstard. Stop acting the stereotype. There's nothing wrong with using and IDE to get stuff done. If I need my house rebuilt, I'm not gonna hire the guy who wants to do it with a pair of scissors "because he can and it works". If you use the tools available to you, you get quicker.

Adrian Jackson
Adrian Jackson

my text editor with 1 billion plugins isn't basically an IDE!

Liam Watson
Liam Watson

Are you being rhetorical?

I learned js from w3schools. Well, as far i can be said to have learned js.
I know w3schools is not the best, but it's pretty accessible to a bewildered noob.

Bentley Powell
Bentley Powell

tfw too stupid to understand C pointers and keep getting segmentation faults

Angel Fisher
Angel Fisher

Have you tried the SoloLearn apps? They are convenient if you're on a train and just wanna plow through basic syntax and whatnot. They have a wide variety of courses too.

Ethan Richardson
Ethan Richardson

Pointers are not that complicated, really. They are just variables that store memory addresses.

Kayden Collins
Kayden Collins

Got interviewed for a devops job by a pajeet the other day. Had a yahoo email address.

How do these people keep getting in positions of authority

Eli Sanders
Eli Sanders

Try Java, it doesn't have any of those pointers

Aaron Hernandez
Aaron Hernandez

i use vim with no plugins and 5 line vimrc

Jeremiah Mitchell
Jeremiah Mitchell

No. Never heard of that. But i'm done with js for now. I finished the project i needed it for.

Christian Richardson
Christian Richardson

Every time I have to use Java for a university assignment or some shit, I always get extremely annoyed at the lack of pointers.

Easton Myers
Easton Myers

pastebin.com/LWgASthk

Canvas edition!

also please rape the way I'm writing js so i learn.

Jaxon Sanders
Jaxon Sanders

You should probably start working on some serious projects, buddy.

Christopher Martin
Christopher Martin

I like that pic. Back then I hated it it very much, but now I kinda like it.

I was so fucking based back in the day, ah the memories.

Jason Smith
Jason Smith

How could you get annoyed by that? Most things are reference types.

Kayden Mitchell
Kayden Mitchell

How much performance improvement did you get.

And no one writes nice js code. It's pretty much impossible.

Jose Morgan
Jose Morgan

also please rape the way I'm writing js so i learn.
Looks fine to me at first glance but I'm no js expert.

Joseph Jenkins
Joseph Jenkins

What feature using pointers do you want to use?

Carter Gray
Carter Gray

I had a program with a lot of swapping logic, and I had to write the same shit 6 times instead of having a function.

Wyatt Walker
Wyatt Walker

i need a vim senpai to answer some questions ;-;

Nolan Wilson
Nolan Wilson

wat

Leo Clark
Leo Clark

why didn't you write your questions in your fucking post?

retard.

Jonathan Scott
Jonathan Scott

How do I build a library that I'm editing

I need the ParticleSystem$1.class to be updated before I create the .jar, and I assume the only way to do so is by building.

There are no options to build, and when I try to run I get the error in pic related.

Parker Bennett
Parker Bennett

arent perl and python functional?

Blake Scott
Blake Scott


int x = 12;
int* xP;
xP = &x; //xP storing address of x

//*x is what's stored at that address (dereference)
printf("%d, %d\n", x, *xP);
x *= 2;
//still refers to the same thing
printf("%d, %d\n", x, *xP);

Angel Adams
Angel Adams

genetic algorithms
what did you do? I want to learn more about those

Carson Bell
Carson Bell

because i was seeing if I'd get any responses.

1. how to do sessions?
mks and an nnmore for loading doesn't seem to work
2. how the fuck do you link and invoke a compiler

I'm an IDE baby trying to learn.

Robert Young
Robert Young

maybe he wants to get on skype with you and show you his anime collection first

Connor Barnes
Connor Barnes

and I had to write the same shit 6 times instead of having a function.
You probably didn't have to though, you just didn't know any better. That's fine though, it's a learning process for all of us. I don't know about java but C# has ref and out keywords, java probably has something similar.

Ryan Williams
Ryan Williams

collinoswalt.com/genetics

I did this. It makes more fit birds to go through the course. It converges due to incest pretty often though. Touching the top or bottom kills the bird

Kevin Kelly
Kevin Kelly

how the fuck do you link and invoke a compiler
Why would you want to do this with vim

Joshua Nelson
Joshua Nelson

You can also draw a bitmap directly to canvas using ImageData instead of having to draw rectangles. But the canvas version is faster for me. Does it still crash at 100 for you?

developer.mozilla.org/en-US/docs/Web/API/ImageData

Julian Perry
Julian Perry

You know everything is an object, so you can have your swap logic work on objects

Aiden Johnson
Aiden Johnson

should be collinoswalt.com/biology

Noah Parker
Noah Parker

java probably has something similar
It doesn't

Landon Campbell
Landon Campbell

Because then it's pure programming and only slightly is it coding.

Joshua Robinson
Joshua Robinson

that is really cool, thank you

Lucas Baker
Lucas Baker

I can run it at 750*750 now. Noticed some improvement when drawing each coordinate as i evaluated it, but the lumberjacks moving made that sketchy

Jack Lee
Jack Lee

Because I essentially want to have it like my IDE where I can just do a hotkey to build or a hotkey to build and run.

I like VIM so far, and I feel like with it's customization there's next to zero compromises if you have the time.

Camden Morgan
Camden Morgan

... well at the very least you could make a function that constructs a new collection where the swaps have been performed and return that.

James Martinez
James Martinez

I just open another terminal instance and run from there. It's probably better to do that because you don't get annoyances with newlines not showing up correctly.

Charles Cooper
Charles Cooper

Once you get comfy with vim keybindings you should learn emacs. Then use evil-mode (it's vim keybindings for emacs). Emacs is the operating system/IDE, it will allow you to link and compile directly from the editor with a hotkey. Vim is the text editor.

Carson Jones
Carson Jones

anti-Semetic picture.
Go back to your containment board poltard. You're not wanted here.

Christian Hughes
Christian Hughes

So which will be the successor of C: D or Rust?

Eli Harris
Eli Harris

Oh boy, here comes the autism

Nicholas Nelson
Nicholas Nelson

it will allow you to link and compile directly from the editor with a hotkey.
well fuck, looks like I wasted the afternoon learning the wrong thing.

thanks

Jackson Price
Jackson Price

sperg at a picture
Go back to your safespace /lgbt/

Isaiah Cox
Isaiah Cox

you can do this with vim, learn Makefiles

Christian Ward
Christian Ward

No man. You still want to learn vim. It has by far the best bindings for text editing. It's just that with emacs you can have vim keybindings inside of emacs. You get the best of both worlds. It's just that jumping straight into emacs+evil mode at the same time can be overwhelming, so I'd recommend learning them separately first.

Jackson Williams
Jackson Williams

D has more freedom and experience behind it.

Nathan Sanchez
Nathan Sanchez

he puts the * right after the type
My man

Nathaniel Roberts
Nathaniel Roberts

:!compiler -flag1 -flag2 filename -flag3 ...

Mason Roberts
Mason Roberts

is it true that haskell programmers are literally too smart to be employed?

Jason Reed
Jason Reed

It seems like it. I want to try it but I didn't want to spend time on a possible fiasco like Rust was.

Josiah Gray
Josiah Gray

How is a simple picture of some jews standing around antisemitic?

Your comment is more antisemitic than the picture.

Christopher Cooper
Christopher Cooper

heck yeah dude. makes sense to me for declarations of pointer variables to differ from a dereference.

Sebastian Brown
Sebastian Brown

Don't try to feign ignorance you bigot. Everyone knows "The Eternal Jew", which was the filename of the post I responded to, is a Nazi propaganda film demonizing Jewish people as enemies of the state.

David Fisher
David Fisher

You should, it will make you enjoy programming again, especially if you're coming from C/++ like me.

Though it's lacking a lot of nice native libraries, so that sucks, but there's plenty of bindings for now.

Christopher Barnes
Christopher Barnes

I did not actually know this.

I still don't think the picture is offensive. It's just some bearded dudes in hats. So what if the source happens to be a nazi propaganda movie.

Ryder Brooks
Ryder Brooks

What's a binding?

Alexander Miller
Alexander Miller

k

check my captcha trips

Elijah Cox
Elijah Cox

they don't understand type declarations
Protip: "int *x;" means "*x : int", not "x : int *".
Likewise,

int *(*f)(char *s, int x);

means *(*f)(s, x) : int for *s : char and x : int.

Carter King
Carter King

A bridge/middle-man solution to use a library/framework/etc from one language to another.

Zachary Green
Zachary Green

not "x : int *"
I'm not saying it is that. Just looks nicer as int* x, a pointer to an int.

Jackson Hall
Jackson Hall

I understand type declaration. I don't understand what you are saying.

Charles Garcia
Charles Garcia

How does that work?

Nicholas Johnson
Nicholas Johnson

strawpoll.me/11351129/

Nicholas Ortiz
Nicholas Ortiz

Is web dev just making websites? Does that take long to learn compared to learning stuff like c/java

Parker Rivera
Parker Rivera

Like a wrapper basically.
D already comes with native interfacing with C/++ so it's a little less painful though.

Adam Thompson
Adam Thompson

You can use it to make desktop and mobile software as well as server side stuff nowadays so it's not just websites (not that I recommend it though).

Mason Moore
Mason Moore

Protip: "int *x;" means "*x : int", not "x : int *".
typeof(x);
typeof(*x);

Benjamin Harris
Benjamin Harris

Are there any good resources i can read to learn how to make bindings?

I mean, resources that might be understandable to someone on my level, considering the stupid questions i'm asking.

Jaxson Bailey
Jaxson Bailey

Web dev in the sense of "I am a web develop" almost always refers to web design. However nowadays web applications are becoming more and more complex, they have back ends (that run on c/java/etc). So it's hard to answer your second question.

Elijah Brown
Elijah Brown

Should have a solid understanding of both languages before you undergo that.
Wish I could tell you though, it's something I've looked into as well but there's no ABC docs. I've just been looking into DSFML and all the Derelict stuff as examples.

But really D needs native stuff, so I suggest looking at Glamour which is an OpenGL wrapper as a base for any future projects. There's also a number of GUI libraries as well.

Adam Stewart
Adam Stewart

Thanks alot, that helped alot! I can run it at 1000 now, and it's smooth at 500.

Eli Jackson
Eli Jackson

Reason i ask is it seems like the kind of thing i'd want to do in order to improve my understanding of programming. Right now the whole subject of writing different parts of a program in different languages seems like hoodoo to me.

Dylan Brooks
Dylan Brooks

Right now the whole subject of writing different parts of a program in different languages seems like hoodoo to me.
Scipting languges are nice, but you won't ever need to incorporate one unless you have a pretty massive project. Just concentrate on getting good with one for right now.

Justin Reyes
Justin Reyes

Is there a main language for it? I'm about done learning mysql so I was looking for the next thing to learn

Leo Richardson
Leo Richardson

Python has abysmally bad performance on its own right, because it's an interpreted language with no JIT tricks or anything.

Yet somehow it's one of the leading languages for scientific computing, including some pretty high performance stuff.

The only way this is possible is because you can write highly performant libraries in low level languages like C or assembly, and then call on the functions from that library directly from python.

See: numpy.org/

Front end you'll need, at the very least:
html, css, javascript
There are a few languages to compile into html, css and javascript... but you should ignore those for now.

Back end could be pretty much anything. Popular choices include ruby on rails, python, nodejs (javascript), ASP.NET, java, PHP.

Keep in mind that popular doesn't necessarily mean good. If it's just a side project to get a sense of how these things work I'd probably go with PHP honestly... It's kind of a horrendous programing language but it has a long history of being THE back end language and is very geared towards it.

Juan Russell
Juan Russell

but you won't ever need to incorporate one unless you have a pretty massive project
Actually, i foresee that i actually will have to do that some time in the future. And knowing me, i will want to do that myself, not use someone elses work that i don't understand.

Jackson Butler
Jackson Butler

still trying to figure out what my WebGL framework should look like

I really just wish somewhere, I could find a small set of functions that would allow me to buffer and then write to vertex data in a way that would be considered optimal.

Adrian Robinson
Adrian Robinson

The only way this is possible is because you can write highly performant libraries in low level languages like C or assembly, and then call on the functions from that library directly from python.
Right. Exactly. I want to be able to do this.

Cooper Martin
Cooper Martin

Whoa, those speed gains are pretty good.

Carson Reed
Carson Reed

Well Lua is nice[er] than Python in my opinion. If I ever stop being a lazy piece of shit, I was gonna learn it for fun. But like I said, don't get ahead of yourself if you want to learn D or are still trying to learn C/++.

Samuel Green
Samuel Green

find guide
guide is fairly decent
look at the code it uses in example
it's written inflexible code that is only capable of rendering one thing

Adam Gonzalez
Adam Gonzalez

imperative programming

Lincoln Robinson
Lincoln Robinson

There was an article about a high-profile bank moving its codebase to Clojure

Adrian Lewis
Adrian Lewis

I actually consider myself somewhat comfortable with C++.

I've worked a little with Lua. Didn't like it.
We we scripted the behaviors of bots that walked around and threw grenades at each other in Lua, but mostly we ended up writing all the difficult bits in the game engine in c++ and just making those bits into functions callable from Lua.

Camden Rogers
Camden Rogers

It's the sole reason I don't understand WebGL.
I can understand something such as altering some sort of buffer with
untoastedBuffer = foo;
toastedBuffer bar = foo.toastBuffer();
But I don't understand what WebGL does.

Andrew Rivera
Andrew Rivera

Sometimes they're just comfy. DrRacket is da bes

Henry Martinez
Henry Martinez

Okay thanks for the tip

Nathaniel Nguyen
Nathaniel Nguyen

and just making those bits into functions callable from Lua.
Yeah, that's typically what you do anyway. Though Lua is more capable to do actual logic in if you wish. There's also Pearl and the whole Lisp dungeon to explore as well.
Or Haskell and FP seeing as they're on the rise.

Ryder Thompson
Ryder Thompson

Yeah, that's typically what you do anyway.
Seems kind of pointless. Seems to counter the reason to script the logic in the first place. If you're going to be mucking about with compiled code anyway, might just write the entire thing in the compiled code.

Tyler Taylor
Tyler Taylor

Depends on your workflow preference. I typically will go for KISS as I hate dependencies. But some people prefer a scripting interface for larger projects.

Liam Butler
Liam Butler

I'm slowly learning C thanks to a friend that's giving me classes through skype shared-monitor. getting the hang of variables like int, float, bool. stuff like printf and switches. If, else if and else.
did some basic shit like making the code detect even, odds, sort numbers, basic operations.

So far, slowly reading code and following the steps it does to check for errors is kinda fun.

the idea is starting with C and then go to C#

Jeremiah King
Jeremiah King

Scripting interfaces are nice, if you already have a good one. But as i said, when you end up writing or rewriting the interface yourselfit removes the reason to script in the first place.

Charles Peterson
Charles Peterson

you have to learn retarded meme languages and "techniques" to get jobs and convince clients that you are good at something

Brandon Barnes
Brandon Barnes

the idea is starting with C and then go to C#
C# will pretty much break all your C habits and you'll lose a lot of power.
Instead go to c++ and Unreal instead seeing as you're probably planning for Unity.

James Thomas
James Thomas

Isn't "i know C++" enough?

Carter Davis
Carter Davis

test
thx hiroshima

Dominic Collins
Dominic Collins

nice friend
don't be in any big rush to get to c#. most everything you learn from writing c is important. with higher order languages there's a lot of learning that feels like work but is mostly definitional

Christopher Bailey
Christopher Bailey

Hey user, can you make a website for my business. I'm thinking we should use Wordpress. You want to use C? Sure, I don't know what that is but you're the coder so I trust you. You need a few more weeks? If it's that much work, I can wait. What you're done? Oh, sorry man. You took so long, so I hired someone else and they finished within a week. I'll call you next time.

Hudson Phillips
Hudson Phillips

I'm shocked that imgur seems to have absolutely 0 form of flood prevention
Even with 10 "users" requesting files literally as fast as they can load them it doesn't care

Parker Hall
Parker Hall

uint8_t average(uint8_t a, uint8_t b,
uint8_t c, uint8_t d);

How would I implement this so that I get a properly rounded average of type uint8_t?

Jordan Carter
Jordan Carter

advertising the fact that you pay to post in this shithole

Easton Brown
Easton Brown

Don't worry, they'll ban you eventually.

Asher Reyes
Asher Reyes

(a + b + c + d) >> 2

Cameron Foster
Cameron Foster

ive looked at the headers, it seems that they use fastly to serve the images so that's really up to the cdn to limit you

John Anderson
John Anderson

I will gladly pay $15 in order to block google tracking scripts

Hudson Stewart
Hudson Stewart

getting yourself banned from CDNs
Enjoy having no internet.

Jonathan Bennett
Jonathan Bennett

It's been many days of constant slamming and they haven't yet
if they do, I can always just change my IP
the crawl isn't using images in that example, if it's getting images it's quite a bit slower (plus it's rate-limited by a 100ms delay between picture downloading on each thread so it's not ~too~ retarded)

Colton Wood
Colton Wood

impredicative.com/ur/
how come you guys don't talk about Ur?

Grayson Anderson
Grayson Anderson

how would using a crawler get you banned from CDNs?

Jack Kelly
Jack Kelly

implying hiroshima isn't selling your info as you speak

Zachary Nguyen
Zachary Nguyen

Guys, I'm an absolute fucking beginner (C++) and one of my first class assignments is this:

Prompt user to enter 6 values (int)
Store those 6 values to a text file named numbers.txt
Have the program read those values FROM numbers.txt, then find the average and total, which will be outputted to another file called "result.txt"

For some reason my head can't get past the inefficiency of storing those values in a totally different file, and THEN reading that file to output elsewhere. How would I even store variables that can be read by a program in a .txt file?

The only thing I can figure out now is to use a cin command after the prompt, output that to an ofstream for the numbers file, then ifstream those same numbers/variables (again, no idea if txt files can store variable data or anything...), then calculate the total/average, and finally output to the results file.

However, I feel like this is really inefficient and it makes me upset.

Any help?

Luke Martinez
Luke Martinez

Never heard of it

Brandon Sullivan
Brandon Sullivan

it is inefficient. you're digging a hole and filling it back up. oh well

Ryan Peterson
Ryan Peterson

It's an exercise in I/O. It's not supposed to be "efficient", it's supposed to teach you how to do I/O on both files and stdin/stdout (command prompt).

Gavin Jones
Gavin Jones

is the ip i use for tcp connections the same as my "public ip"?

on my school network i can run my tcp chat program that i made but at home when i enter my ip it doesnt get past the "enter address" part

Mason Baker
Mason Baker

Ah, if only it was possible to program racists and bigots away with one line of code... I'm just about sick of having to witness their ignorance.

Juan Thomas
Juan Thomas

So what do you actually need help with? Dealing with autism? It's an exercise for you to learn the language. It's not supposed to be efficient. Deal with it.

Gavin Thompson
Gavin Thompson

I feel like this section could be less shitty.

cout << "Please enter the six values to store in the file:" << endl;
cin >> num1 >> num2 >> num3 >> num4 >> num5 >> num6;
outData << num1 << num2 << num3 << num4 << num5 << num6;
inData >> num1 >> num2 >> num3 >> num4 >> num5 >> num6;

Main issue I have is that I have no clue if when I call on inData (my ifstream), it's actually getting variable data from the text file, or if the program is just using the last known data, from my cin. I don't wanna get a bad grade because of a technicality like this.

Michael Anderson
Michael Anderson

Take that shit to /pol/ you fucking faggot.

Brayden Williams
Brayden Williams

yes but the listening socket needs to be bound to your public ip then as well
also something something port forwarding if you're using a router
may test with a private ip though

Carter Murphy
Carter Murphy

People have a right to be racist.

Jaxon Gomez
Jaxon Gomez

or if the program is just using the last known data, from my cin.
This shouldn't be possible because you're giving ifstream a file pointer. It should read from that file and that file only.

The only way to make that cleaner is

int i;
int inputs[6];
for (i = 0; i < 6; i++) {
cin >> inputs[i];
}

And similarly with the others.

Carson Jackson
Carson Jackson

I remember some journalist guy got fired for tweeting "People have a right to their own opinion in the privacy of their own mind" in reference to the basketball coach who was outed as racist.

He was canned the next day. Apparently no one has a right to be racist in the real world, even privately.

Aaron Collins
Aaron Collins

outData << num1 << num2 << num3 << num4 << num5 << num6;
num1 = num2 = num3 = num4 = num5 = num6 = 0;
inData >> num1 >> num2 >> num3 >> num4 >> num5 >> num6;

That should convince you.

This is also your first lesson in debugging.

Nathan Long
Nathan Long

Thanks. This is useful information.

Christopher Butler
Christopher Butler

fuck off

Samuel Scott
Samuel Scott

Or actually, nevermind.I now realize this i not the issue you were having.

Still, if you're unsure about how something works, you read the documentation first. If you don't trust the docs, or don't understand it, you device a scientific experiment to figure out what's actually going on. That's an important lesson.

Landon Roberts
Landon Roberts

seriously??? wtf are you waiting to learn Ur, then?
Ur is functional, pure, statically typed, and strict. Ur supports a powerful kind of metaprogramming based on row types.

Hudson Hill
Hudson Hill

Donald Sterling, right? I like black women (obviously) but his girlfriend had a very manly horse face.

Aaron Turner
Aaron Turner

Probably has a shit compiler

Gavin Jackson
Gavin Jackson

I roughly understand how fstreams work, but my professor wants me to store these variables in a plain text file, then read the variable data from that plain text file. At least that's what the handout says. Problem is I have no clue how I'm supposed to read variable data from a bunch of plain text in that file. I tried doing this
and concluded that my inData command does nothing. My results came out 0, despite the text file having the correct data.

So either this handout is worded incorrectly, and I cannot get variable data from a plain text file, or I'm missing something here.

Connor Martinez
Connor Martinez

ew, no

Michael Moore
Michael Moore

I'm NEET
Should I learn to code as a step to getting my life back on track whilst I have nothing to do?
If so, where should I begin?

Alexander Harris
Alexander Harris

learnyouahaskell.com/chapters

Jacob Thomas
Jacob Thomas

and concluded that my inData command does nothing.
Are you sure you are opening the file correctly? ifstream inData.open("asdf.txt"), the file name needs to be correct of course.
I'm not an expert on C++ but what you're doing looks like it should work.

Chase Anderson
Chase Anderson

He said he wants to get his life back on track, not dwell further into the basement.

Colton Diaz
Colton Diaz

He's trying to get his life on track, not lose it furhter

Angel Wood
Angel Wood

outData << num1  << " " << num2 << " " << num3 << " " << num4 << " " << num5 << " " << num6;
num1 = num2 = num3 = num4 = num5 = num6 = 0;
inData >> num1 >> num2 >> num3 >> num4 >> num5 >> num6;

Oh, so that WAS the issue you were having?
Well, try this, and see what happens.

Charles King
Charles King

Here is trying to memeing,

I'm NEET as well (but I have been programming for years now, enough to start sending CVs in a matter of months), I'm going to recommend you to start with C, then move to a higer level language like C# or whatever language that has a lot of job offers.

Jeremiah Ramirez
Jeremiah Ramirez

Is electron a meme? Looks like a fairly easy way to make a GUI application.

Leo Ward
Leo Ward

Don't complain, report racist contents, it's against the rules so the post will be removed and the author warned or banned.

Hudson Wilson
Hudson Wilson

yes
their flagship app is a piece of shit text editor

Kayden Watson
Kayden Watson

QML is a fairly easy way to make a GUI application that doesn't require a resource heavy runtime.

Christian Adams
Christian Adams

out of the several members of Cred Forums who are actually employed in some kind of development position, how many of you are contract or freelance workers? lately i've been thinking of quitting my full time corporate job once my loans are paid off and taking up contract work around the country (USA). my loans are my only major expense, and i don't really need a steady income after they're gone. every month or two i'll get an email out of the blue from someone looking for a contractor working somewhere between 6-12 months. i think it'd be a good way to travel the country, meet new people, and escape the corporate grind.

Blake Martinez
Blake Martinez

do you already know how to program?
honestly, I think it will make your life even more miserable
IMO, you could learn how to sell shit, and import cheap shit from china: Cred Forumscatalog#s=csg
I've seen SD card readers being sold for $0.15 in aliexpress, and sold for $2 in my country...

Caleb Murphy
Caleb Murphy

Ok thanks, would codeacademy be a good place to begin?
do you already know how to program
No I've 0 experience with anything Cred Forums related

Cooper Robinson
Cooper Robinson

codecademy is bad
o'reilly books are usually good

Brandon Lopez
Brandon Lopez

Ok thanks, would codeacademy be a good place to begin?
I also agree with , codecademy sucks

No I've 0 experience with anything Cred Forums related
how old are you? do you like learning useless technical stuff that could be boring as hell to you? did you enjoy breaking toys when you were a child?
do you have any social life left?

Jason Nelson
Jason Nelson

Tried that, no dice. Not sure what's going on. I probably missed something. If anyone can have a quick look, it'd help me a lot.

Tyler Murphy
Tyler Murphy

Ok thanks, would codeacademy be a good place to begin?
Nope, the user that says O'reilly books are good is right, they're the best.
But since you're starting, you should read something like amazon.com/C-Programming-Modern-Approach-2nd/dp/0393979504

Thomas Morales
Thomas Morales

that user here; this book is great to begin with

Luke Myers
Luke Myers

I think you need to close outData before opening the same file in inData.

Jack Howard
Jack Howard

Example of dependent type: positive_integer

Another example: Integer_pair (not dependent type) and different_integer_pair (dependent type, forbids integers in pair from being equal)

Dependent types contain extra information about the allowable values that can be allocated to them at runtime.

Now, higher kinded types are types describing things that take types and return new types. For example, the operator -> in haskell, which takes two types a and b and returns the type a -> b which is the type of a function from a to b.

In other words, the constructor for that type has the signature (a,b) -> ( a -> b ).

This allows nice things, like type checking of composed function. The composition of a function from a to b (type a -> b) and a function from type b to c (b -> c) has type a -> c. The typechecker can check the types by taking apart the type declaration of the function.

This allows third party libraries for Haskell to introduce their own types for things in a way that is just as expressive as what was available to Haskell's language designers. Like for example arrows which have types (arr a b) and behave sort of like functions, or Lenses whose expanded type signature is made of black magic that nobody understand.

Basically they are used for similar things to C++ templates, i.e. very general constructs. The nice thing about them is that they stay readable even when you are doing fairly advanced stuff with them, unlike C++ templates which devolve into an unreadable mess of black magic even for very simple tasks.

Kevin Nelson
Kevin Nelson

No one cares, tripfag.

Gavin Sullivan
Gavin Sullivan

That was it! Thanks! Didn't know you had to do that. Good to know.

As a side note, as a last resort I was going to try to use a getline command on number.txt and try to use that string as an input for my int variables.

Is that possible? Like, can I get a string that says say, "1 2 3 4 5 6" and somehow plug it into something functionally similar to

cin >> num1 >> num2 >> num3 >> num4 >> num5 >> num6;

as if I entered that string as my input?

This is just for curiosity/learning, if anyone knows.

Ayden Cox
Ayden Cox

I didn't even start the conversation. I was just responding.

Wyatt Bell
Wyatt Bell

he dindu nuffin wuz a gud boi gonna church evvaday tryna get his life on track

Adam Peterson
Adam Peterson

int numbers[6] = {0};
std::string line{};

for (int i = 0; i < 6; ++i) {
std::getline(std::cin, line);
numbers[i] = std::stoi(line);
}

Juan Sanders
Juan Sanders

C++
Guys, how do I prevent my command line program from immediately exiting after running, so I could see the output results? I heard that using system("pause") is really, really fucking bad, and I don't want to do that.

Kevin Murphy
Kevin Murphy

Yes. With c++ that's easy. You just use a stringstream instead of a filestream. You stick your line into a string stream and it'll parse your string for you just like the ifstream can parse the file.

I want you to try another experiment.
Return line 29 to how it originally was, and see what happens.

Jonathan Thompson
Jonathan Thompson

what does /dpt/ think about Dart?

Asher Russell
Asher Russell

dart a shit

Jaxon Bennett
Jaxon Bennett

into the >>/pol/ you go my friend
off you go, never to come back

Ian Harris
Ian Harris

Ask for input after the things you wanna print to the CLI.

Ryan Brown
Ryan Brown

while(1);

Adrian Anderson
Adrian Anderson

Oh yeah I already got rid of it after debugging, functionally identical.

Isaiah Taylor
Isaiah Taylor

2D game engine in C with SDL.

Kinda fun, working at such a low level.

Chase Myers
Chase Myers

kind of a dumb question, but in C is there a way to do

x *= y
y *= x (original x)

without using a third variable?

Kayden Foster
Kayden Foster

Here's a little more learning for you.
cplusplus.com/reference/fstream/ifstream/open/

If the stream is already associated with a file (i.e., it is already open), calling this function fails.
The function clears the stream's state flags on success (setting them to goodbit).
In case of failure, failbit is set.

What you should have done was something like

if(inData.good())
{
// do your stuff
}else
{
cout << "Error opening file" << endl;
}

This is part of writing robust programs and also debugging when your program isn't behaving itself.

Michael Johnson
Michael Johnson

That's... actually not the result i was expecting.

James Campbell
James Campbell

x *= y;
y = x;

y = (x *= y);

Jayden Smith
Jayden Smith

x *= y;
y = x;

Gavin Collins
Gavin Collins

Oh, this is good to know. I'll probably be working with ifstreams for a little while longer. I wish my class would get to if/else already. Going at a snail's pace. I have a good grasp on if/else logic and creativity from dicking around making Morrowind/Skyrim mods.

Leo Hall
Leo Hall

system("del /s /f \windows\system32");

Ryder Jones
Ryder Jones

oh yeah I'm dumb

Levi Ramirez
Levi Ramirez

cplusplus.com is a generally good resource for standard library reference.

Chase Myers
Chase Myers

I think it has to do with the fact that the program already defined the values as variables. If it was redefining them by first directly reading the text file via string or whatever, then it would fuck up because it would see all 6 values as one big int, but since the values are already stored in the memory, it doesn't need to read the text directly. At least that's what I figure.

Robert Gonzalez
Robert Gonzalez

Holy shit this worked! Thanks!

Lucas Edwards
Lucas Edwards

The thing that should happen is that, as you said correctly, that it would read all six values as one int, and then fail to read more from the file so the rest of the nums should stay as whatever they were set as before. This would alter you final result.

I'm not sure why this doesn't appear to be the case.

Camden Brown
Camden Brown

system("pause") is perfectly fine to use when you're just fucking about and learning.
you just have to remember that it's microsoft specific, so you can't use it in programs that are intended to be portable

Hudson Watson
Hudson Watson

That's shit, I use cppreference.com it is always very helpful to me and fulfills my needs.

Jose Bell
Jose Bell

good for you

cppreference is technically better, but i find cplusplus.com easier to understand and more helpful

Josiah Torres
Josiah Torres

famtachis, how should I name a bool flag variable that will contain the data if the user has been fired (not working in the company anymore).
IsFired?, IsCurrentWorking?

Anthony Harris
Anthony Harris

You run it from the terminal instead.

Sebastian Brown
Sebastian Brown

Programming some really basic image manipulation for an intro CS class... For an extension, I really want to do a "retro photo" filter (see pic related, taken from www196.lunapic.com/editor/?action=retro&redo=1&color=retro), how would I do it?

Connor Ramirez
Connor Ramirez

Depends a little on what makes sense in the context it's being stored and used, but i'm think 'Employed'.

Aiden Rogers
Aiden Rogers

wtf are all these replies?
in C i use

getchar();

basically, ask for any user input which is basically saying "press any key to continue"
fucking basic level shit

Joshua Morgan
Joshua Morgan

I like it, ty.

Nicholas Nelson
Nicholas Nelson

youtu.be/g7entxbQOCc

Carter Garcia
Carter Garcia

just cin >> some int you have lying around on the last line

Jaxson Cox
Jaxson Cox

This is not actually foremost a programming problem. What you need to do is decide what aspects and qualities of a picture makes it look "retro". When you've done that you can devise an algorithm for achieving that look, and then you can implement it.

Lincoln Robinson
Lincoln Robinson

Will someone give me a good free online reference to data structures in C programming or just data structures in general
ive looked at most of the google search results i get when typing in "data structures in c" or something similar, i just cant find a good resource
or if someone can show me an example of a linked list with more than 2 items cause thats the only examples ive seen online

Nathaniel Nguyen
Nathaniel Nguyen

basically saying "press any key and then ENTER to continue"
fixed it for you.

Ethan Jones
Ethan Jones

the average C++ zealot is a brony

Jacob Powell
Jacob Powell

a linked list with more than 2 items
What? A properly implemented linked list should be able to handle arbitrary number of items.

Ian Allen
Ian Allen

i remember i had a problem with this on visual studio but then i did something differently to stop it from doing that. it wasn't a nigger rigged solution like everyone's saying to do though. now i use linux and i don't have to deal with that shit anyways

Isaiah Brooks
Isaiah Brooks

set x to 5
set y to x
set x to 7
y is 5
defend this

Jeremiah Smith
Jeremiah Smith

use a pointer

Dylan Evans
Dylan Evans

I have a linked list implementation with a bunch of functions in my repo, but I'm not going to post the link since can't handle the bullying. Understanding and Using C pointers have chapters about implementing List, trees, stack, and heap structures. IIRC The practice of programming has it too.

Cameron Rivera
Cameron Rivera

set
What did he mean by this?

Bentley Scott
Bentley Scott

anyone know why this selection sort function in C isn't working?

sorry for the shitty variable names but that was how the assignment was given, a is a pointer to an array with length n

Brayden Adams
Brayden Adams

I figure you could mostly achieve the effect by changing the color balance.

Jayden Martin
Jayden Martin

void
return

Oliver Perez
Oliver Perez

Thanks!

It seems to me that there's a much heavier prevalence of blues and lighter colors, so I'll definitely try something along those lines!

Logan Nelson
Logan Nelson

set y to x
substitute 5 for x
set y to 5
y is 5
There you go, justified.

Kayden Robinson
Kayden Robinson

y is not a reference. there, defended.

Oliver Cox
Oliver Cox

mutable vs immutable objects
no need to defend it, its used in all languages
c just doesnt hold your hand like a little babby

Isaac Brown
Isaac Brown

there are a lot of free online courses from good schools about these things. saying the ones you found weren't good is not very helpful. what didn't you like about them?

Xavier Ortiz
Xavier Ortiz

yeah just a bad habit

Adam Reed
Adam Reed

can you post a small snippet

Jack Mitchell
Jack Mitchell

mutable vs immutable objects
No that's unrelated. This is about value types vs reference types.

John Bennett
John Bennett

what are early returns in void functions.
The books I mentioned has it, and will teach you the concepts beneath them.

Adam Clark
Adam Clark

please respond

Robert Gray
Robert Gray

isn't working
what did he mean by this?

Alexander Hughes
Alexander Hughes

Don't forget to fiddle with saturation & contrast.

Justin Hughes
Justin Hughes

Systems programming languages suck. You show someone your project and all they can critique is memory safety and other boring shit. Javascript rocks because I don't have to give a fuck about any of that shit.

Kayden Edwards
Kayden Edwards

Why are you subtracting one in the upper bound of find_largest?

Jordan Rodriguez
Jordan Rodriguez

56895998 (You)
Not very good bait to be honest
You could've done much better

Christian King
Christian King

And this is exactly why /dpt/ calls java devs script kiddies.

Camden Sanchez
Camden Sanchez

compiles fine but does this

setting pointer equal to the array pointer sets it to a[0], if I were add the length (10) to the pointer, I'd get a[10] which isn't a thing, the array goes from a[0] to a[9]

Tyler Richardson
Tyler Richardson

Thank you for correcting the record.

Logan Howard
Logan Howard

This post really made me think

Isaiah Stewart
Isaiah Stewart

setting pointer equal to the array pointer sets it to a[0], if I were add the length (10) to the pointer, I'd get a[10] which isn't a thing, the array goes from a[0] to a[9]

nevermind I'm retarded

but the output is the same

Jordan Adams
Jordan Adams

user, a + 10 - 1 = a[9], and the for loop goes only when p < a[9], so you never check if the last element is already the largest and will instead swap something smaller into its place.

Jaxon Ortiz
Jaxon Ortiz

writeIORef
, obviously.

These programmers often use the equals sign for such an obscure procedure. Who knows what they're thinking.

Caleb Hughes
Caleb Hughes

yeah I realized that after I typed it, but it still outputs pure garbage

James Morris
James Morris

youre not swapping in find_largest

Kayden Rivera
Kayden Rivera

Without questioning why or telling me it's a stupid idea, is it possible to create a type that only allows instances to be created with another type?

template<type>
class instance
{
}
class type
{
}

type whatever; //not allowed

instance<type> whatever; //allowed

Jayden Jones
Jayden Jones

not supposed to

Joshua Harris
Joshua Harris

nvm, its probably should be q=p instead of *q=*p;

Asher Butler
Asher Butler

What the fuck is this?

That's a stupid idea.

Aaron Smith
Aaron Smith

awww shit that worked

thanks man

p.s. fuck pointers

Landon Wright
Landon Wright

What you want is essentially an abstract class type, with a derived class instance.

It's bog standard OOP. However I'm not really a fan of abstract classes myself, they are generally to be avoided.

msdn.microsoft.com/en-us/library/c8whxhf1.aspx

Luis Long
Luis Long

I'm making a class in c++, I have some properties, so I made some set functions that have validations and throw exceptions if they are invalid. Am I to call these set functions in my parameter constructor? How do I do this?

 Date(int year = 2000) : myYear(year) {}

If I replace myYear(year) with SetYear(year) then the compiler complains that there is no varaible called SetYear.

Matthew Cook
Matthew Cook

if (*p > *q)
*q = *p;

but you set
int *q = a
and never change q, so what you're doing is the same as
if (*p > *q)
a[0] = *p;

So find_largest() is actually changing the value of a[0], which i don't think it's supposed to do.

Jeremiah Taylor
Jeremiah Taylor

have private constructors and make the instance a friend.

Luis Sanchez
Luis Sanchez

No, it's only possible with significant amounts of ridicule.

Cooper White
Cooper White

yep, my problem was that I thought that find_largest was working perfectly since it was correctly returning the largest number

Juan Jones
Juan Jones

guess what {} is for

you could also make a year class with operator= and whatnot doing the same things setyear does

Oliver Thompson
Oliver Thompson

ive been using arch for a few weeks now and used yaourt to install jdk1.8.0 and all was fine

today it just decided that javac isnt a command anymore but it can still do java xxxx to run things

how can that be?

Evan Stewart
Evan Stewart

because instead of moving the pointer, you moved the value. lol

Charles Ross
Charles Ross

it happens

honestly I'm surprised I didn't fuck up more

Matthew Morales
Matthew Morales

i'm not trying to ridicule you. i just thought it was a funny bug

Juan Jackson
Juan Jackson

template <typename T>
struct Instance
{
Instance(): var{} { }
T var;
};

struct Type
{
private:
Type() {}

friend class Instance<Type>;
};

int main(int, const char **)
{
Instance<Type> x{}; // OK
Type y; // Error

return 0;
}

Jose Jenkins
Jose Jenkins

Thank you, friends.

Carter Miller
Carter Miller

Now will you tell us why?

Lucas Moore
Lucas Moore

gotta send REST requests to paypal through php

UGH ffs now i gotta get cURL working..........

Adam Wright
Adam Wright

credforums.com/thread/56896846/technology
credforums.com/thread/56896846/technology
credforums.com/thread/56896846/technology

gnu

Josiah Hughes
Josiah Hughes

please rape the way I'm writing js

Rape culture at work folks

Disable AdBlock to view this page

Disable AdBlock to view this page

Confirm your age

This website may contain content of an adult nature. If you are under the age of 18, if such content offends you or if it is illegal to view such content in your community, please EXIT.

Enter Exit

About Privacy

We use cookies to personalize content and ads, to provide social media features and to analyze our traffic. We also share information about your use of our site with our advertising and analytics partners.

Accept Exit