[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]
4chanarchives logo

/dpt/ - Daily Programming Thread


Thread replies: 328
Thread images: 38

File: wow dude.jpg (178KB, 934x1000px) Image search: [Google] [Yandex] [Bing]
wow dude.jpg
178KB, 934x1000px
old thread: >>54505857

What are you working on, /g/?
>>
FIRST4TRAPS!
>>
>>54510936
Second for D
>>
>>54510936
Just finished all my exams.

AMAA about theoretical computer science, cause I'm at the height of my understanding right now and it's all downhill from here lol

>>54510953
ye
>>
>>54510936
please stop the anime cancer on this board
>>
>>54510936
kys
>>
>>54511007
MOOOODS!
JUST BAN THIS SHITTER ALREADY!
>>
File: mallocast.png (1MB, 1280x720px) Image search: [Google] [Yandex] [Bing]
mallocast.png
1MB, 1280x720px
>>54511007
KEEP OVERFLOWING THE STACK, HIME!

>>54510936
Now that exams are over I'm going to start working on my HDL again. And maybe write some simple networked game.
>>
File: 35426271_p0.png (651KB, 561x800px) Image search: [Google] [Yandex] [Bing]
35426271_p0.png
651KB, 561x800px
>>54510936
nth for coq
>>
>>54511019
I'm sure on reddit, you would already have 3 automated bots responding to you about how your mod request has already been received and how your little feelings are special and deserve to be protected.

Stop posting this shit every thread.
>>
File: nsa.jpg (92KB, 1366x768px) Image search: [Google] [Yandex] [Bing]
nsa.jpg
92KB, 1366x768px
>>54510993
>>54511019
>>54511062
>desperation

Listen, man, try to contribute something productive to this thread.

Does anyone know of any languages/projects that compile to Haskell? I know there are compilers that translate Haskell to JS, but that's the other direction.
>>
>>54511007
kys

>>54511033
kys

>>54511035
kys
>>
>>54511062
SUCK IT FAGGOT!
>>
Does writing NSIS scripts count as programming? Because that's what I'm doing right now.
>>
>>54511076
kys
>>
>>54511076
>mental illness
you should seek help tho
>>
Thinking about how to deal with reporting errors in my language's compiler.

The issue is that the language is written in a high-level form, which is then elaborated down to a core theory before doing type checking. So errors at the type checking stage that want to report the problematic code will print terms of the core theory, not what the user is expecting to see.

For example, the high-level data type of natural numbers could be encoded in the core theory as a W-type:
-- written
data Nat : Set where
zero : Nat
succ : Nat -> Nat

-- elaborated
Nat : Set
Nat = W Bool \{ff => Empty; tt => Unit}
zero : Nat
zero = sup ff \{}
succ : Nat -> Nat
succ m = sup tt \{tt => m}


I'm sure the user would rather see that a value wasn't of type "Nat" rather than "W Bool \{ff => Empty; tt => Unit}". This will be tricky.

>>54511076
What would be the point of compiling to Haskell? JS is basically the assembly of the web, so it makes sense to go the other way.
>>
>>54511076
>contriboot something productive
>animuuuuuuuuuuuuuuuuuuuu
>>
>>54511116
>assembly of the web
End you're self!
>>
>>54511133
Like it or not.
>>
>>54511116
>assembly of the weeaboo
ftfy
>>
File: indians5.png (44KB, 753x772px) Image search: [Google] [Yandex] [Bing]
indians5.png
44KB, 753x772px
Which programming languages are going to be the top 5 languages in 2020?
>>
File: dpt.png (2MB, 1696x2467px) Image search: [Google] [Yandex] [Bing]
dpt.png
2MB, 1696x2467px
>>54511116
I'm just curious. Sometimes people make DSLs which happen to build into a language they're familiar in. Haskell developers tend to be the type that more often understand parsers compiler theory and such, so I thought it would be interesting if I could find at least one example.

>>54511136
Yeah, it's a fact of life whether you like JS or not. He's going to get banned soon enough, don't worry.
>>
Anime babies should just leave /g/.
>>
>>54511120
Honestly, just kill yourself; you can't even program, why are you here?
>>
>>54511162
parsers and*
>>
>>54511162
>soonâ„¢
ZEN
E
N
>>
>>54511150
Java
C
C++
C#
D
>>
>>54511162
>it's a fact of life
Is JS really going to stay this ubiquitous?

Why is there no competition?
>>
>>54511175
>animooooooooooooooooo
>mental illness
>muh degeneracy
honestly, can you even average 2 ints?
>>
>>54511185
>no javascript
>D

>>54511150
C
Javascript
C++
Java
C#

In that order.
>>
>>54511212
kys
>>
>>54511150
Javascript
Coffeescript
Clojurescript
Go
ScalaJS
>>
>>54511175
Why are you responding to him?

People like that thrive off of the negative attention. They want to be the counterculture for the smug points.

Just let them tucket themselves out with all the kicking and screaming.
>>
>>54511162
>Haskell developers tend to be the type that more often understand parsers compiler theory and such

That's rich.
>>
>>54511195
int avg(int a, int b)
{
return ((a + b) / 2);
}
>>
>>54511229
>tucket
tucker

Although, tucket should be a word for something.
>>
>>54511229
>Let's just enjoy our mental illness
anon...
>>
>>54511252
nao u've dun it m8
>>
File: [tilting increases].png (27KB, 500x500px) Image search: [Google] [Yandex] [Bing]
[tilting increases].png
27KB, 500x500px
>>54511162
>Haskell developers tend to be the type that more often understand parsers compiler theory and such
>>
>>54511252
What if I wanted it to be exponentially smoothed average?
>>
>>54511252
animeshits should off themselves
>>
>>54511252
>what is integer overflow
>>
>>54511290
is it anime?
>>
File: indians4.jpg (246KB, 1017x873px) Image search: [Google] [Yandex] [Bing]
indians4.jpg
246KB, 1017x873px
Question 1:
Write a function to calculate an estimated size of one's penis by programmatically utilizing online sources of your choice.

This estimate should be based on two given inputs: race and height.
>>
File: xdress.png (1MB, 1702x2471px) Image search: [Google] [Yandex] [Bing]
xdress.png
1MB, 1702x2471px
>>54511190
The biggest problem is the difficulty to debug translated code which has more than an arm's length difference from JS. Source maps are getting better over time though, and in languages similar enough to JS you can just debug your non-JS code in the browser as if it were JS. But still, even in a language like Coffeescript, which bases its entire type system and model for functions on JS, debugging can be a pain when things go wrong (especially in a poor environment like Safari). Then you have to look at the actual JS it generates and it's terrible.

The most versatile competition that isn't just a wrapper for JS is Emscripten, which ironically results in the most garbled horrific JS you'll ever see. Emscripten is so accurate though that when you debug, so long as you're not debugging the border between your code and browser APIs, you might as well just run the C++ natively and debug it there.

The downside? Emscripten also results extremely large JS files (used to be a lot worse), and sometimes getting things to be interoperable is a pain. For example, to make a game loop, you need to use a special setup to play nicely with JS's asynchronicity (you can't just sleep, that'd hang the browser window if it existed). Emscripten has been making leaps and bounds over time, though.

Hope this answers your question robustly. Also, bonus skirt image.
>>
public float psize (into race, into height) {
return Math.random()*8;
}
>>
File: threading.png (20KB, 566x450px) Image search: [Google] [Yandex] [Bing]
threading.png
20KB, 566x450px
How have I fucked up. Errors aren't explaining shit to me/I'm retarded
pic related
>>
>>54511351
So something like Apache Cordova runs on Node.js, and Node.js is just a wrapper for Javascript?

Is the entire internet just Javascript wrappers at this point?

>>54511359
0/10, no APIs.
>>
My boss caught me sleeping on the job again. This coding job literally pulls me to sleep. He wasn't too made since my work was done but fuck. How can I make C interesting?
>>
>>54511401
More pointers
>>
>>54511370
std::thread t1(&TestingObject::graphics, this);
>>
>>54511401
More mental illness
>>
>>54511401
triple redirection!
>>
File: sicppat.jpg (286KB, 1024x768px) Image search: [Google] [Yandex] [Bing]
sicppat.jpg
286KB, 1024x768px
>>54511370
I think you need to do
&TestingObject::graphics
but I rarely use C++ so just try it and see

>>54511398
Cordova doesn't use Node.js. It actually uses the JS environment of whatever browser it has available. But yeah, the JS world is a total mess of libraries abstracting each other at this point.

>>54511401
It's probably not C that's the problem, it's what you're being asked to do.

>>54511440
>indirection
>>
>>54511401
>C interesting
C is tedious. That's like asking how to make shelf-stocking in a hardware store interesting.

I mean, yeah, you could use a forklift as a skateboard and have lightsaber fights with flourescent tube light bulbs nigger-rigged to 9-volt batteries. But then people look at you funny and you might get fired anyway.
>>
Hey gee, can you average 2 numbers?
Let's make /dpt/ great again (none of this anime trapshit)!
>>
>>54511453
>C is tedious
>I'm below average
>>
>>54511455
#include <math.h>

i dont know what im doing help
>>
>>54511432
Thanks that worked
>>
>>54511401
If you C is that tedious, consider writing a C code generator in a higher level language to do the work for you.

Yo dawg, I herd you like to program...
>>
>>54511475

C is tedious, there's no way around that.
>>
>>54511370
By definition you need "this" to be passed to t1 in order for your method to execute, just "graphics" with no explicit receiver won't work. For a way to do this, either use a lambda or something like http://en.cppreference.com/w/cpp/utility/functional/mem_fn with a bind.
>>
>>54511475
C is tedious, though. Makes no difference whether you are competent.
>>
>>54511482
Maybe for the incompetent.
>>
>>54511497
Do you know what tedious means?
>>
>>54511432
>>54511491
Wait, ignore, that guy is right, the constructor of thread can manage it.
>>
>>54511495
>tedious tho
>trust me, I'm one of the incompetents
>>
>>54511502
Do you?
>>
>>54511528
It doesn't mean "difficult", that's for sure.
>>
>>54511491
There's no this, it's a static class man
>>
>>54511538
Putting "static" before a class declaration doesn't do anything in C++.
>>
>>54511530
>I don't actually know but it sure ain't anime
>>
>>54511538
>static class man
wew laddie
>>
>>54511538
graphics() has to be static too in order to do

std::thread t1(graphics);


(I think?)
>>
>>54511497

Not an argument.
>>
>>54511601
>DELETE THIS
I didn't mean to offend you.
>>
>>54511549
Oh, oops. I was thinking like he had put static before the member functions. My bad.
>>
>>54511596
>>54511549
>>54511616
solution found, ty anyway
here: >>54511432
>>
>>54511615

Still not an argument.
>>
gulp vs grunt vs bower: go!
>>
>>54511649
>gulp vs grunt vs bower
One of these things is not like the others.
>>
https://www.youtube.com/watch?v=oUzXEV5qigQ

standard rectilinear projection is no good when the viewer is far away or the screen is too small! it's why console games have such narrow fov. in this video with just 120 fov everything is distorted like crazy and the things you focus on in the center of the screen are tiny unless you view it in full screen and sit very close to the monitor
>>
>>54511668
>I'm the real webshit
o-ok
>>
>>54511649
why does that girl have a bulge in her pants?
>>
>>54511674
>unless you view it in full screen and sit very close to the monitor

Well, that's sort of the point. People who play PC games are generally playing them in fullscreen and are sitting close to the monitor.
>>
>>54511704
yes but imo it's not the optimal solution in all situations for example mobile games
>>
>>54511699
she's a programmer
>>
>>54511717
>mobile games
please
>>
>>54511674
I usually shoot for ~130 FoV on my 21:9 35" ultrawide that I sit right in front of.

You wouldn't use that FoV on a narrower screen you're setting far away from.

>>54511717
>it's not the optimal solution in all situations
Who said that it was the optimal solution?

I don't understand why you're in /dpt/ posting about this.
>>
>>54511733
sorry i forgot this is the steam greenlight only unity babby thread
>>
>>54511755
>mobile baby
anon...
>>
>>54511764
>unity babby
kid...
>>
File: tegaki.png (6KB, 800x400px) Image search: [Google] [Yandex] [Bing]
tegaki.png
6KB, 800x400px
>>54511674
>>
why should i use enums instead of
#define WAIT 0
#define CALL 1
etc
>>
File: tegaki.png (5KB, 400x400px) Image search: [Google] [Yandex] [Bing]
tegaki.png
5KB, 400x400px
>>54511777
Furthermore.
>>
>>54511212

This sounds like a reasonable assessment. Maybe Python in there somewhere.

>>54511252

assert(avg(INT_MAX, INT_MAX) == INT_MAX);


>>54511401

Get a better sleep schedule. If you have your programming done at work and you still have time, there's always still work to do. Run it through rigorous tests. Help your coworkers with anything they're having difficulty with. Ask your boss if he has any more work to do. You want to get a promotion to a job you might enjoy more, show your boss that you won't be the kind to sleep on the job, but instead, take action without being told he needs to.

>>54511370

>static class TestingObject

This isn't a thing in C++. The only reason C++ allows the keyword static before the keyword class is to allow you to create a static object of that class in the same statement as creating the class.

https://codeyarns.com/2012/01/10/c-static-class-definition/

So remove the static keyword. It's an eyesore, and it makes you look like you're a retard trying to write C# in C++.
>>
>>54511811
can't see shit captain
can't look around easily because shit controls captain
>>
>>54511828
Okay.
>>
>>54511777
>PC wide
You'd need a seriously large monitor to be able to have your face at that relative distance.
>>
>>54511855
Yeah, it's a bit exaggerated.
>>
>>54511808
Because of scoping purposes, which also makes the code more clear. Other than that, I don't think there's much of a difference (maybe compiler implementation is different performance/memory-wise?)
>>
So let me get this straight. If I use SFML or OpenGL I need to have a main loop for them to keep the window open (presumably on a different thread). Inside that main loop I'd have to create an event system to check what needs to be drawn in the current iteration. This event system would then be accessed by the rest of the program to add shit to the next render.

Where's the graphic libraries that don't need a main loop. That can just window.drawPng(int x, int y, string file)
Then it's up to ME when I clear the screen and render the screen.
My uni has their own library for this but I thought I'd try SFML. Now I hate this fucking looping so WHAT DO
>>
>>54511961
What's the end-goal of your project?
>>
>>54511961
ffs just read this
https://www.packtpub.com/game-development/sfml-game-development
pirate it/dl source code

good book
>>
>>54511961
You don't need a loop, you don't need multiple threads.

It completely depends on what you're trying to do.
>>
>>54511972
I'm currently just setting up the generic base. The different controllers which get user input and output. I guess eventually I'd like to make a simple platformer to test my self. But I'm writing this initial part generically enough so I can use it as a start point for multiple projects.
>>
>>54511961
You don't need a main loop for OpenGL. Not sure about SFML but I doubt you do there, either.
>>
>>54511961
in SFML it is up to you to draw and clear the screen
you need to call the draw function on the texture
>>
>>54512001
>>54512017
>>54512023
If the method that creates the window ends, the window closes. Hence you need it to loop until the end? Or is there another way?
>>
>>54511961
What the fuck is wrong with message looping? You are the first person I have ever known to have a problem with the message loop system. Just fucking use GLFW and set the loop to
while(!(glfwGetKey(window,GLFW_KEY_ESCAPE)))
>>
>>54512040
Why not just redraw when needed and close the window when the code says to close the window?
>>
>>54512064
because your loop won't only contain methods to draw but several different things
>>
>>54512057
Because it just makes everything more difficult?
I can't write a method in my graphics manager called DrawPNG(int x, int y, string file). Because it can't pass it into the main loop to be drawn directly.
It has to be added to some storage array to be temporarily held until the loop is at the point where it checks the array?
I'm probably fucking retarded but that's what I think I have to do right now...
>>
>>54512111
Why not just have a loop for the several different things?

If the GUI is going to sit there completely static for 10 seconds, why do I have to loop constantly during those 10 seconds?
>>
>>54512133
Is this your first time working with a state machine?
>>
>>54512040
>Or is there another way?
some libraries will keep it open for you.

Fundamentally you can make a thread that sleeps, and wakes up when events are triggered.
>>
>>54512133
>Because it can't pass it into the main loop to be drawn directly.
Why would it not be able to draw immediately whenever you call it?
>>
>>54511150
C
C
C
C
C++
>>
>>54512156
I've learnt about FSM but not really sure how this applies now

>>54512176
Because if it's looping, in a thread, lets say called GraphicsLoop(). How do you pass data to that loop directly? You can't? You just have to store it in an array that it will look at during it's loop? Right?????
>>
>>54512205
This is not how anything works. Not games, not UI frameworks.

In games, you often have a "game loop". and in that you have *everything*. Game logic, graphics, sound everything. You don't have a graphics loop and a game logic loop, they are just 1. The game logic is generally at the start of the loop and the graphics stuff is at the end of it.

You almost never use different threads to try to draw things for a lot of reasons. One of which is cross thread latency. Another is that it quickly becomes a cluster fuck, so you better have a real good reason to use a separate thread.
>>
>>54512151
>why don't I just hard code entire seconds of visuals, rather than having the computer do it for me

Because for most people, their time is worth considerably more than a CPUs.
>>
>>54512319
I don't disagree with you on that. Maybe I'm misunderstanding the concept of shoving everything into one loop.
>>
>>54512279
I've spent about 100 hours developing the rest of the logic though. I've split it all up into different controllers. I wanted to keep my input, logic, and output completely separate. I made my own looping system which logs everything, and maintains a constant loop time using the system clock.
The last piece was to hook it up to a graphics library. But apparently the graphics library wants to BE MY LOOP. wtf. Why do I feel like it's overstepping. The graphics was going to be the tiny part.
>>
>>54512356
most graphics you just register shit to draw and when you've registered all that shit, you call the draw function.

what graphics library are you using that "wants to be the loop"?
>>
>>54512346
Some things will be on the screen for a long time, and some things will be there for a single frame only.

The point is, unless you have different loops for "held" vs single frames, you need each iteration of the loops to take the same amount of time.
Also, you probably want to be checking things even if the screen isnt changing, otherwise it's gonna take forever to respond.
>>
>>54512356
>But apparently the graphics library wants to BE MY LOOP.
If you already have a loop than just do all your draw calls a the end of it. Whats the big deal? Just about every graphics library I can think of allows this.
>>
>>54512396
SFML
I posted this above
"If the method that creates the window ends, the window closes. Hence you need it to loop until the end? Or is there another way?
"
But I think OpenGL does the same thing
>>
>>54512421
see>>54512423

though I may be retarded
>>
>>54512423
>If the method that creates the window ends
that should be thread, not method. Just create the window in your initialisation code and draw to it at the end of your loop.
>>
>>54512423
dude what?

I've never used SMFL but I've used SDL / OpenGL.

Most often you create a rendering context (the window) and when you're done, you destroy that context. There is no "end of method" shit like you're talking about. You create the window, draw a bunch of shit to it, and when you're done you just destroy it as part of your "end of life" routine for your controller.
>>
File: Untitled.png (46KB, 818x505px) Image search: [Google] [Yandex] [Bing]
Untitled.png
46KB, 818x505px
>>54512423
Proof that you do not need the message loop in OpenGL. At least not with GLFW.
>>
>>54512458
Okay I'll give OpenGL another crack then

>>54512444
That's a good point actually. That could work. It'd be confusing in the overall look of my loop but I could put up with it.

thanks anons
>>
>>54512444
This could work. It'd look weird in the context of my project but I'll give it a go.

>>54512458
Okay I'll try to use OpenGL again

>>54512498
thanks anon I'll try this too
>>
>>54512205
did you make a multi-threaded system and didn't think about communication between those threads?
>>
>>54512567
>It'd look weird in the context of my project but I'll give it a go.
What were you expecting to do?
>>
>>54512578
No it's one thread I just thought I HAD to make another thread for the graphics loop. Thanks to someone on the previous /dpt/
>>
File: the loop.png (28KB, 800x600px) Image search: [Google] [Yandex] [Bing]
the loop.png
28KB, 800x600px
>>54512586
It's just that the MasterController will have to create the graphics window and pass it to the OutputController. Because otherwise it'll close (using SFML anyway...) because .output will end
>>
>>54512665
anything that isn't data, i.e. thing that change, shouldn't be going through THE LOOP and should be in your master controller.

so the master controller has some method "draw" which does all that shit. on creation in makes the window. on destroy it destroys it.

why doesn't that work?
>>
>>54512711
Master controller is only there for the management of the sub controllers. It manages how fast the loop runs, and provides debugging information.
The other controllers communicate between themselves Nothing is passed up to MasterController.
>>
>>54512665
Why can't the output controller create it?
>>
>>54512747
from what i'm understanding the output controller gets allocated and destroyed each loop or something
>>
So if I'm making a game, should I keep graphics, logic and input as 3 separate threads?

Should the game loop be on a different thread?
>>
>>54512747
Because if the method that creates the wndow ends, the window closes for some fucking reason
>>
>>54512762
Where did you read that? That's garbage. You just need to stop the tread that created the window from terminating.
>>
>>54512761
no. Everything should be on one thread.
>>
>>54512761
depends on your experience with threads and how big of a game you're making.

typically graphics & input are going to be on the same thread because input comes from the graphics context (the window).
>>
>>54512780
Ugh welcome to my past 2 hours
I don't know why but that's what SFML is doing
Trying OpenGL now if I can stop filling out 4chan captchas
>>
>>54512800
How am I supposed to keep a consistent framerate tho?
If both the input loop and graphics redraw are in the same thread, the game will run only as fast as my input loop
>>
>>54512810
SFML has no way of knowing what method created it. You're getting mixed up some place.
>>
>>54512810
you don't know why you're destroying the window?
post some code because this shit is getting everyone no where
>>
>>54512830
i'm assuming you're using some graphics libraries. they spawn threads behind-the-scenes so you don't have to deal with them. this means your input/graphics/logic will all be non-blocking in the loop
>>
File: Untitled.png (77KB, 1157x624px) Image search: [Google] [Yandex] [Bing]
Untitled.png
77KB, 1157x624px
>>54512762
What do you mean?
>>
File: 7846658.jpg (44KB, 651x335px) Image search: [Google] [Yandex] [Bing]
7846658.jpg
44KB, 651x335px
Can anyone tell me why vim is (comparably) slow on Mac OS X?

E.g. if I do a visual block selection, and an insert, and press ESC, in vim it takes ~3 seconds for the changes to appear.

If I do the same thing in Emacs with evil mode, it's instantly.
>>
>>54512761
There would be no point, they have to happen in lockstep and in sequence anyway (no logic to do without input, nothing to render if nothing has moved), spinning up multiple threads would just incurr overhead.

What you should use multithreading for in a game is offloading async work to background threads like asset loading, sound mixing, procedurally generated content, maybe building certain auxiliary data structures for collision detection, etc.
And of course the actual rendering or physics could be multithreaded, but the main loop (get input, update, draw) should be your synchronization point.
>>
>>54512762
just make a sf::RenderWindow in your windowcontroller class and it won't close unless you tell it to
>>
>>54512796
>Everything should be on one thread.
Isn't this horrible advice? Wouldn't slightly complex calculations lock the game briefly and make it stutter?
>>
What's the go-to source for learning Haskell?
>>
>>54512830
Don't use any blocking calls when getting input, you should just be polling the current state of the keyboard, mouse, gamepad, etc.
>>
>>54512982
Most of the really cool tricks are inside the heating sleeves of Hot Pocketsâ„¢ Pepperoni-Flavored Sandwichesâ„¢
>>
>>54512982
Your local retirement community.
>>
>>54512975
this is true but no one here is making their own gaming engine for the next AAA 3D game.

a single-threaded 2d game is fine for hobby/learning
>>
File: fucking SFML.png (48KB, 1201x481px) Image search: [Google] [Yandex] [Bing]
fucking SFML.png
48KB, 1201x481px
>>54512887
>>54512832
It pops up for a split second then closes
>>
>>54513010
That's like teaching someone who is writing their first data-driven GUI to not async out the database call because the 5-line, locally hosted query is basically instant.

Why not do it right the first time?
>>
>>54513010
That's a pretty black and white way of looking at things. There is a massive middle ground between Skyrim and Cave Story.
>>
>>54512975
>Isn't this horrible advice?
no
>Wouldn't slightly complex calculations lock the game briefly and make it stutter?
yes. Multiple threads doesn't solve this though besides some exceptional scenarios. Making a game run faster by using multiple threads is very very tricky. Some game/physics/graphics engines will do some of this for you behind the scenes, but it's unwise to try it yourself unless you have an exceptional reason.
>>
>>54512975
How would another thread help?
Still not gonna have that calculation ready, so you will render the last known state which will look like the game froze at that point.
>>
>>54513019
you're letting main() end. Don't do this.
>>
in C/C++, is:
*x // as in dereference

the same as:
x[0]

?
>>
>>54513024
first you must learn to make a game

>>54513028
i'm sure cave story uses 3d rendering for lighting and plus it has music/etc. please stop looking for things to argue about. neither of those games are "hobby/learning" tier
>>
>>54513040
>>54513046
Say you're continuously calculating the trajectory of a ball.

Rather that stuttering the game when the calculation is made, the music, background, timer, etc all continues while the physics choke for a small, unnoticable amount of time. It's more noticeable when literally everything freezes, rather than one small item.
>>
>>54513062
No I'm not? It's still doing the getline?
>>
>>54513070
Yes.
>>
>>54513088
No I'm saying you are an idiot for assuming we are all making shitty, baby pixel platformers when it is inherently untrue.
>>
>>54513126
/dpt/ is /beginner programmer general/ friendo
>>
Any opengl es c++ wrappers for plebs?
>>
>>54513104
Replace getline with std::cin>>str; so we can see the results.
>>
will i need a skirt to do the needful and becoem a petter programmer?
>>
>>54513126
but you are LOL
>>
>>54513097
>unnoticable amount of time
if it's unoticable then why not let it choke the main thread? A dropped frame is very noticeable.

>It's more noticeable when literally everything freezes, rather than one small item.
Even if you think that it's much much much easier just to use on thread. Doing stuff like physics on a separate thread creates a lot of overhead. The main thread has to message the physics thread about work it wants it to do. Then when the physis thread is done it has to message back the main thread. This alone can be a 20ms round trip (someone correct me on this, maybe there's more efficient ways). Not to mention the added complexity of deadlock and race conditions. Avoiding this creates more overhead. Sometimes a huge amount depending on what you're doing.
>>
>>54513164
Nice, you rekt me good son.
>>
>>54513097
If sound, physics and rendering are all completetly decoupled in seperate threads they would go out of sync if one of them doesn't hit the target framerate, and from that point forward you'll forever have say the sound in the future X seconds (so you'll hear something before you see the action which caused it ).

Sound, physics and rendering must all be synced at 60 Hz (or w/e your framerate is), and they must all hit it.
>>
>>54513189
suck my cock u lil gay boi LOL
>>
>>54513149
Same result. I also put a loop in Main(), looping 9999999999 times (takes a few seconds), and the window doesn't stay open any longer.
>>
>>54513104
Which takes <1ms to complete. Then the method ends.
>>
>>54513198
Put it at the exact moment before the window closes.
>>
>>54513201
see >>54513198
>>
>>54513201
Doesn't getline() wait for user input?

Main shouldn't end until something is entered in the console.
>>
>>54513198
because that sf::RenderWindow goes out of scope as soon as SFMLManager::CreateWindow finishes.
You have to make that renderwindow a field in that SFMLManager class, and then in CreateWindow use window.create(allthatstuff ...)
>>
>>54513228
No.

Cin waits for user input.
>>
>>54513215
and you're surprised why?

I'm not a c++ guy, but do something like:
while(true) {
getLine(blah);
Thread.sleep(16);
}
>>
>>54513150
of course bb
>>
Anyone here have any tips for staying awake during software testing?
>>
>>54513243
I have
private:
sf::RenderWindow window;
in SFMLManager.h

>>54513214
What?
>>
>>54513320
Masturbation.
>>
>>54513320
Hook up a failed test assertion to a stun gun.
>>
>>54513323
Forget it, have you tried creating the window in main instead of in a function? The problem could be scoping.
>>
>>54513358
you're gonna fall asleep during your afterglow

>>54513320
Take off your clothes.
I'm assuming you're in an air conditioned cushy building.
The cold will keep you awake.
>>
>>54513323
You have a member and are not using it. in the body you've redeclared a new window

do this->window(...), not what you have.
>>
Hello guys I'm a senior in high school taking a pre ap comp sci class our final is to make a game. I wanna just make a simple space invaders type game and I was wondering what exactly am going to need to accomplish this and also are there any good tutorials I can watch?
>>
File: shit.png (29KB, 683x649px) Image search: [Google] [Yandex] [Bing]
shit.png
29KB, 683x649px
I know I'm going to catch shit for this but my project is due in 40 min

I have the solution already but it won't compile for some reason. I keep getting Exception in thread "main" java.langNumberFormatException: For input string


it's this one right here.
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-092-introduction-to-programming-in-java-january-iap-2010/assignments/MIT6_092IAP10_assn07.pdf

The code is right but it won't compile. It's cool if you guys don't want to help. I'll just submit as is
>>
File: 1417911861742 (2).jpg (9KB, 145x119px) Image search: [Google] [Yandex] [Bing]
1417911861742 (2).jpg
9KB, 145x119px
>>54513421
>Notepad
>>
>>54513374
Well the whole problem is that I don't want to use a loop. The solution is finding a way so that the window doesn't close at the end of the method it's made in. So moving it to Main proves nothing. Of course the window will stay open if I put cin >>str after it. It stays open when I do that in CreateWindow().

>>54513388
see pic
>>
>>54513421
pastebin the code

why are you using a fucking text editor
>>
>>54513421
sounds like parseInt is failing. Haven't used java in awhile, does it have the equivalent of a tryParse? you could debug by printing out the result of a split before parsing and summing.
>>
File: Capture.png (5KB, 689x52px) Image search: [Google] [Yandex] [Bing]
Capture.png
5KB, 689x52px
>>54513451
>>54513388
oops here
>>
>>54513421
convert the boolean to a string? can't test your code if it's in an image.
>>
>>54513451
I'm not telling you to use a loop, I'm telling you to take all the things you placed in functions and put them in int main()

A function has its own "scope" and when the function ends everything declared in it is discarded with the exception of whatever is "returned" and whatever values you pass to it as pointers.
>>
>people trying to do graphics programming when they don't even understand the language they are working with
>>
>>54513462
is the manager static?
>>
I believe my C skills are pretty good now. What do I write now, so I can practice? I though of comting to the linux kernel, but I have no idea where to start?
>>
>>54513487
>Why even learn things if you don't already know them!
>>
File: sagsag.png (27KB, 1268x444px) Image search: [Google] [Yandex] [Bing]
sagsag.png
27KB, 1268x444px
>>54513323
it works
>>
File: int.png (181KB, 713x833px) Image search: [Google] [Yandex] [Bing]
int.png
181KB, 713x833px
I'm working on a C program for a microcontroller. Currently learning about interrupt handling. Pic related, is there any difference between the three different ways of declaring an ext. interrupt service routine?

Currently I am using it like this:

ISR(INT0_vect) {

}
>>
>>54513455
>>54513465
http://pastebin.com/xZMVACyb
>>
>>54513479
My point was that it works in main but offers no solution.

>>54513499
Nope

>>54513514
OMG THE SOLUTION.
So I was using the RenderWindow constructor, instead of .create(), which takes the same fucking parameters. One of them closes after the current method ends. One of them doesn't. Fuck me. Thanks everyone ima go kill myself
>>
File: Capture.jpg (60KB, 1722x308px) Image search: [Google] [Yandex] [Bing]
Capture.jpg
60KB, 1722x308px
>>54513505
Not the point, you don't seem to understand basic C++, which is sort of a requirement before doing anything more advanced with it.
>>
>>54513562
What is the exact error you're getting?
>>
>>54513501
Write a heap allocator first.
>>
What's the point of getters and setters?
>>
>>54513562
System.out.println(fileName + " is magic? " + testMagic(fileName))


testMagic() returns a boolean.

Does Java implicitly convert that to a string?
>>
File: j.png (6KB, 624x100px) Image search: [Google] [Yandex] [Bing]
j.png
6KB, 624x100px
>>54513609
>>
>>54513581
>So I was using the RenderWindow constructor, instead of .create(), which takes the same fucking parameters. One of them closes after the current method ends
No, that was not the problem.
>>
File: bewaretheneckbear.png (1MB, 1000x7835px) Image search: [Google] [Yandex] [Bing]
bewaretheneckbear.png
1MB, 1000x7835px
>>54511266
>>
>>54513629
Sanitizing your inputs and preventing compatibility issues between different API versions.

It's really only useful if you're writing a robust library, but if your setters and getters do nothing but assign a single variable, they're basically pointless.
>>
>>54513623
What do you mean exactly? Doesn't malloc do it?
>>
>>54513642
Comment out the
sum += Integer.parseInt(par);


Instead, print out all of the 'parts' with println.

What is your output?
>>
>>54513581
>So I was using the RenderWindow constructor, instead of .create(), which takes the same fucking parameters
Which doesn't matter, they do the same thing, however, you created a window inside your "CreateWindow" function, that window gets destroyed as soon as that function returns.
>>
>>54513358
>>54513385
I work in an office were everybody can see everybody else. So that isn't going to work.

>>54513359
I'm 90% certain that stun guns are illegal were i live. I do have access to plenty of 24V power supply's though.
>>
>>54513599
I wasn't even the person you were arguing with. I was just interjecting to call you a simp.

If you're struggling with something you are passionate about you double down not give up.
>>
>>54513629
So that you can do things when a value is retrieved or modified.

You can make the set private, or you can make the getter return an arbitrary number of pictures of penises.

The sky is the limit.
>>
>>54513629
they are the anti-pattern of OOP
>>
>>54513070
Yes. In-fact, x[offset] is syntactic sugar for *(x + offset), so 0[x] would work too (but don't do it)
>>
>>54513686
>>54513646
Oh it was because I was making a variable insite CreateWindow, and not the same one as the private variable which is saved.
Either way it works now so im out
>>
File: 1334439603801.png (70KB, 208x193px) Image search: [Google] [Yandex] [Bing]
1334439603801.png
70KB, 208x193px
>>54513678
You wonderful bastard. That fixed and it compiled. I don't understand why but thanks my friend

I owe you big time
>>
>>54513740
lmao dude do u not understand local scope?
>>
>>54513752
Yeah I understand but I just thought I was storing it outside of that method
>>
>>54513743
What

No, I was trying to get you to understand why it was breaking.

The issue was that your strings weren't in a format that was able to be parsed into integers.

That was a debug test, not a 'fix'.
>>
>>54513126
>Stop talking to me as if I'm some kinda noob asking for advice about super basic shit on a Mongolian cave painting gallery.

If you knew what you were doing, you wouldn't have to ask kid.
>>
>>54513455
What's wrong with using a text editor?
>>
>>54513780

It's too late. He probably already submitted it.
>>
File: GY!BE3.jpg (322KB, 1440x900px) Image search: [Google] [Yandex] [Bing]
GY!BE3.jpg
322KB, 1440x900px
Did a crash course on Python so that I can try Cython out
Now I'm going to be looking at the Linux kernel source code
>>
>tfw making a program to help sort and tag porn

I don't know whether to feel positive about having a goal and useful end point to work towards, or sad about the tragic purpose it will be used for.
>>
File: wtf.gif (1021KB, 235x156px) Image search: [Google] [Yandex] [Bing]
wtf.gif
1021KB, 235x156px
>>54513743

Another CS student passes with flying colours everyone!
>>
>>54513894
>Anonymous image board
Why are you assuming I was asking for help? Do you think it's just me and you in this thread?
>>
Can't sleep.
>>
>>54513979
Can't get a gf
>>
>>54513979
Can't wake up
>>
>>54514009
Same
>>
>>54513977
Why are (You) assuming that the same advice would be given to other anons who actually seem to understand what they are doing?

If you tell someone "well the proper way to do it is x, but you're not ready for that yet so use y" they are likely to just go ahead with x anyway to "save time".
To get around this, people will just tell someone that y is the best method and let them work out when it's best to change methods on their own.
>>
>>54514049
I want some (You)s
>>
>>54513979
drink a bottle of hard liquor as fast as possible. always makes me sleepy
>>
>>54514009
Can't get a bf
>>
>>54514070
Let him put it in your ass, and then in your mouth immediately afterwards.
>>
How do I create C-style strings in javascript?
>>
>>54514070
are you a grill?
>>
>>54514110
>girls
>dpt
lol, of course not, I'm a gay guy
>>
File: 1453106237631[1].webm (2MB, 640x478px) Image search: [Google] [Yandex] [Bing]
1453106237631[1].webm
2MB, 640x478px
>>54514123
Are you a gay goy guy?
>>
>>54511243
There's two scenarios, then. Do you think statistically, Haskell developers understand parsers and compiler theory

a) equally
or
b) less

compared to any developer you pick off the street?
>>
File: 1435597855902.jpg (163KB, 1536x2048px) Image search: [Google] [Yandex] [Bing]
1435597855902.jpg
163KB, 1536x2048px
>>54510936
Today I used basic scripting skills to scrape a premium gallery content from a model site.

Picture related
>>
>>54514123
it's not that improbable. 50% of programmers and 75% of project designers in my workplace are women and not even in an sjw way. surprisingly, they aren't shit at their jobs
>>
>>54514222
Would suck
>>
I already know javascript syntax because it's so similar to C, but how do you actually do anything on a webpage with it?
Do you interact with the DOM or something?
>>
>>54514202
That depends, are the streets designated?
>>
>>54514262
You have 4 workers in your office?
>>
>>54514202
Personally, I'd say more likely.
>>
>>54514295
I'm saying, compare any random Haskell developer to any random developer. It was a metaphor - I wouldn't screw up the statistics by biasing selection for location.
>>
>>54514296
close. 8 programmers and 4 designers
>>
>>54514336
>my statistically irrelevant and statistically outlying office is enough for me to comment affirmatively on the probability of a particular anon being a woman, given a selection of a male-dominated industry on a male-dominated website
>>
File: takei.jpg (11KB, 441x408px) Image search: [Google] [Yandex] [Bing]
takei.jpg
11KB, 441x408px
>>54514334
It's a joke m80.

Anyway, haskell devs may well be better on average as most CS theory, doesn't mean they can put any of it to good use.
>>
File: Capture.png (128KB, 536x704px) Image search: [Google] [Yandex] [Bing]
Capture.png
128KB, 536x704px
And here begins my journey as a computer programmer!
>>
>>54514437
Sick blog, subscribed.
>>
File: frog.gif (199KB, 336x468px) Image search: [Google] [Yandex] [Bing]
frog.gif
199KB, 336x468px
>>54514107
https://developer.mozilla.org/en-US/Add-ons/Code_snippets/StringView

Uses typed arrays to give you a pointer-like interface for strings. It's the closest you're going to get.

>>54514382
I've very rarely found a decent Haskell developer who wasn't reasonably competent in a more practical language as well -- usually they're more competent.

>>54514437
Remember to have fun and wear skirts.
>>
>>54514447
Rude as h*ck
>>
>>54514437
Install Gentoo
>>
>>54514452
I'm a male so skirts aren't really for me lol
>>
Anyone else thinks writing for loops is annoying as fuck? Having to manually declare an index and set it's increment when 99% of the time you just use i or j and only increments by 1.

instead of
 for(int i = 0; i < max; i++) 

it would be much better to have
 
//index is auto declared as in
//base case where you go index from 0 to max
for(i, max)
//overloaded case where you don't start
for(i, min, max)
//overloaded when you need to increment more than 1
for(i, min, max, increment)

this would make writing for loops like 20x faster
>>
>>54514452
>I'm saying, compare any random Haskell developer...
>I've very rarely found a decent Haskell developer...

Can you say the same thing about a random Haskell dev though?
Can you really?
>>
>>54514484
Some languages already have a foreach loop
>>
>>54514482
you will never be a good programmer
>>
anyone got experience with the visual C++ linker?

assuming i have:
static library A
static library B, which depends on A
shared library (DLL) C, which depends on B

will C need A in order to compile, or can it just use the library generated when compiling B?
>>
>>54514484
>I just invented the foreach

grats my dude
>>
>>54514484
>What are macros
>>
>>54514484
Looks like you're destined for matlab
for i=1:20
end
for i = 2:2:20
end

I don't like matlab and I don't like your alternative though. Consider string iteration in C:
for(int i = 0; string[i] != 0; i++)

that's no longer reasonable in your new for loop.
>>
>>54514516
you don't get indexs in foreach
>>
>>54514569
You do with D
foreach(int i, int val; arr)
{

}
>>
File: saika.jpg (85KB, 540x730px) Image search: [Google] [Yandex] [Bing]
saika.jpg
85KB, 540x730px
>>54514482
Oh just you wait

>>54514492
You're getting confused. I wasn't talking about my statistical argument about parsers and compilers there. I was responding to him talking about Haskell developers' ability on the practical side of things.

But if you want me to, I can make it use equal specificity as the original statement.

I've found it pretty uncommon to see a Haskell developer who wasn't reasonably competent in a more practical language as well -- often they're more competent.
>>
>>54514569
You do in common lisp!
>>
>>54514569
This
>>
>>54514569
Lua loops a p.cool
for i = 1, 100 do
-- 1 <= i <= 100
end
for i,v in ipairs(A) do
-- A[i] = v
end
>>
So I'm attempting to get jtextfields to write to a position in an array as they're updated, and right now I have this

public class textlistener implements FocusListener {
public int location;
}

but when I try to update it using textlistener.location = i; I get an error saying that it can't find symbol.
>>
>>54514603
Haskell developers would also never successfully write a DSL because they'd try to do it pure and never finish. GHCI is STILL written in C.
>>
>>54510992

what should i study over the summer if i want to understand data structures and algorithms in c++
>>
File: aJCWN1H.png (8KB, 666x126px) Image search: [Google] [Yandex] [Bing]
aJCWN1H.png
8KB, 666x126px
>>54514569
Sure you can.
>>
>>54514714
Pole dancing.
>>
>>54514714

You should study data structures and algorithms in c++
>>
>>54513003
>>54513007
Not for work, just for personal.
>>
>>54514757
>versus
for (int i = 0; i < dickList.Length; i++) {
WriteLine($"{dickList[i]} is at index {i}");
}

And it's probably faster too.
>>
>>54514757
That's longer than writing a for loop..
>>
>>54514484
"those who would sacrifice clarity and uniformity of syntax for pointless syntatic sugar deserve only one fate: death" - gerald sussman
>>
>>54514780
>>54514791
Well yeah, my example has some overhead.

I was just saying that you can retrieve the index if you really want to.
>>
>>54514794
foreach actually has non-syntactic practicality when you introduce iterators. And if you don't think iterators are fucking rad then you obviously haven't seen Rust
>>
>>54514780
>>54514791
Oh, and a simple for statement won't call Dispose on a disposable enumerator.

You can always try to remember to dispose it yourself, but I think it's worth noting.
>>
>>54514829
>foreach actually has non-syntactic practicality
false
>>
>>54514847
It's just far more shorter that getting the iterator and dispose it after.
>>
>>54514592
In most other languages it's secondary rather than primary.

>>54514516
So do you think Haskell developers know less about parsers and compilers than developers as a whole?

>>54514677
What about pure languages makes you think people never finish projects with it? And it's not GHCI, it's the RTS. That's done partly for performance reasons and partly because some of the most fundamental aspects of Haskell (such as the garbage collector) can't be written in Haskell itself. That wouldn't make sense.

>>54514714
Understanding algorithms/data structures is kind of its own subject compared to C++ - I would try to learn them together, but from separate resources. There's a lot of good C++ tutorials, that you might have read already (not sure how far you are). The canonical textbook for data structures and algorithms is Introduction to Algorithms; you can find it online too.
>>
>>54514831
Why can't "Dispose" resources in C# just automatically get disposed when they go out of scope?
What happens if you dispose something and then try to use it afterwards?
(not a C# programmer)

>>54514847
Manually looping over an iterator is a pain in the ass, much much worse than a traditional C loop.
Also, iterators don't necessarily have random access and can be infinite.
>>
>>54514847
see
>>54514831

In C#, foreach will automatically dispose a disposable enumerable after its done, much like a 'using' statement.

>>54514895
The specific type of resource I'm referring to are *Reader objects, like DataReader. They will open a connection to a source of data and maintain a read lock until disposed.

For example, normally if you're reading from a text file, you call a Using statement, which automatically releases the read lock on the file when done.
>>
>>54514895
>Why can't "Dispose" resources in C# just automatically get disposed when they go out of scope?
It's not a stupid idea, but in which order do you dispose the resources?
>What happens if you dispose something and then try to use it afterwards?
It depends, normally you should face exceptions, but who knows?
>>
>>54514885
>>54514770

I'm already reading data structures and algorithms in c++ by Drozdek. Should I use Intro to Algorithms book with it?
>>
what's the best language to learn data structures and algorithms in? Java? C++? I have some idea about them, but it's rusty and at this point I only know the applications and I doubt I remember how to implement anything more complex than a linked list. I hate reading pseudocode and the algorithms described this way often lack some mayor parts that come up when you actually try to implement them.
>>
NEW THREAD!

>>54514945
>>
>>54514950
too soon
>>
>>54514885
Pure languages discourage prototyping and iterative design just as static languages do. Haskell is not only pure but highly static.

In order to solve a problem in Haskell you have to already know the structure of the problem in specific detail, and as such Haskell is suffocating. Iterative design in Haskell requires a lot of refactoring of type declarations.
>>
>>54514948
>what's the best language to learn data structures and algorithms in?
OCaml
>>
>>54514963
It hit the bump limit retard.

I'm all for calling out early new threads, as long as they're actually fucking early.
>>
>>54514942
It's probably not a bad idea. I'm unfamiliar with that book personally, but it might be helpful to see both sides of an algorithm (psuedocode and C++). As long as you use a quality learning resource, the biggest factor imo is your own willingness to stick to it and keep learning.
>>
>>54514983
I'll respond to this in the next thread.
>>
>>54514932
>but in what order do you dispose the resources?
In the reverse order that they were declared

>>54514948
I would definitely for sure say that neither are the best languages for learning about data structures and algorithms.
C++ requires you to understand the memory model and the stack and a lot of the implicit weird behavior that C++ does without telling you.
Java forces you to write in an OOP way and understand a bunch of weird OOP things like, everything-is-an-object and the fact that static things have to be declared static and non-static thing are implicitly not-static, and learning about "this" and whatever.
Basically, both languages impose complication onto the programmer that they have to learn and understand before they can even start to implement data structures and algorithms well.
I would say a simple imperative language like Python that while it imposes some syntax onto you, it doesn't impose any design choices onto you.
Some people might also recommend functional languages like OCaml and Scheme.
The problem with OCaml is that you have to understand the type system to an extent and you need to learn how to write in a functional style, which may be weird only if you're coming from a procedural background (e.g. C, C++, Java). The problem with Scheme is that its syntax is wildly different from most procedural languages like C and Java, although if you can get over that then I think that it's an excellent language.
>>
>>54514994
first page is too early to start a new thread, bump limit or not, you fucking mouthbreather
>>
>final executable is 10mb smaller than the .lib i linked against
does the linker remove unused stuff or should i start worrying?
>>
>>54515112
Once you hit the bump limit it's going off the front page within minutes, if not seconds.

Why don't you stay in this thread and talk to yourself while everyone goes over to the next one?
>>
>>54515027
>In the reverse order that they were declared
I'm sure there will be annoying cases, but it would works for most of cases.
>>
>>54515115
For static linking, yes.

It would be impossible to fit anything mildly complicated on an embedded system if complete libraries were compiled into the executable.
>>
>>54515027
I know Java very well, feel much less comfortable with C and C++, but don't have problems with pointers and memory management. those are the only languages I know. I dunno if learning algorithms in a completely unfamiliar paradigm is a good idea, but maybe I'll try
>>
>>54514885
>So do you think Haskell developers know less about parsers and compilers than developers as a whole?

I think they probably know about the same, relatively fuckall.

Functional programming doesn't divinely bestow some arcane knowledge.
>>
VxWorks documentation is the fucking worst. Trying to make a syscall hook for some filesystem stuff.

>Get pointer to filename string from real time process
>Use vmTranslate to turn it into a physical address
>Apparently this returned an error, and the pointer it gave back is somehow valid, but also pointing to garbage
>Maybe the process doesn't have virtual memory on it. Maybe it's all physical
>Just straight up dereference the pointer in kernel mode
>general protection fault and simulator crash

And the documentation will show how to set up a system call, but doesn't give much in the way of examples of custom system calls, or how the fuck to take an address from a real time process and turn it into a physical address the kernel can use.
>>
File: pr.jpg (37KB, 600x467px) Image search: [Google] [Yandex] [Bing]
pr.jpg
37KB, 600x467px
Suppose I have a method returing a pointer to a class named Dog.

I have my Dog object
std::shared_ptr<Dog> dog;


Now let's say I call that method and I want to assing the result to my dog
dog = std::make_shared<Dog>(some_method());


This should be correct, right?

What if now I want to access a dog's member. Let's say paw.
some_var = Dog->paw;


This doens't work in my code (I get rubbish); I also tried
some_var = Dog.get()->paw;


What's wrong? I'm kinda new to the smart pointers' world, so I can't really figure it out.
Thread replies: 328
Thread images: 38
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK