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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 356
Thread images: 22

File: 1491145897328.gif (473KB, 500x355px) Image search: [Google]
1491145897328.gif
473KB, 500x355px
What are you working on, /g/?

Old thread: >>59968831
>>
First for OOP
>>
every year you live through is cached in memory, so the next year moves faster because you're already familiar with a year. The longer you live, and the more data/years you save in memory, the faster time seems to move.
>>
>>59972955
fpbp
>>
File: 1440628124386.jpg (49KB, 576x402px) Image search: [Google]
1440628124386.jpg
49KB, 576x402px
Do you follow the class oriented or prototype (native) oriented style of writing? What is the common agreement on this issue?
>>
>>59972925
Thank you for not using an anime image.
>>
you're looking kind of sexy, Donnie
>>
>>59973009
>Do you follow the class oriented or prototype (native) oriented style of writing?
These aren't well established ideas anon. I suspect you're asking if people prefer object oriented programming or procedural/imperative programming?

Or is it less strict so you're asking if people prefer to do their code exploration with the presumption that they will be using a class vs the presumption that they don't want to use a class for things?
>>
>>59973009
class prototypes
>>
>>59973058
Oh God sorry , I meant in javascript. Sorry.
>>
>>59973079
>>>/g/wdg
>>
Would it be a bad idea to use webp for thumbnails in my chan clone?
>>
>>59973079
/dpt/ doesn't like ECMAScript that much and I doubt they use it.
>>
File: apina.jpg (58KB, 546x546px) Image search: [Google]
apina.jpg
58KB, 546x546px
What is man supposed to use when here's just no good statically typed and compiled language.
>sml
no good implementaion
>ocaml
sml with shitty syntax, also does not support native threads
>lisp
too verbose, also static typing not standardized
>c
decent but manual memory management is annoying in prototyping phase
>sepples
cluster fuck that no sane person would touch
>d
can't decide if it wants to have gc or no
>rust
better stay away from it because it attract lot of crazy hipsters, also uglier than sepples
> any jvm/clr lang
requires huge vm
>go
Rob Pike is faggot, also no macros
>>
>>59973009
Neither
>>
>>59973121
Ada
>>
>>59973101
unless you want to keep old browsers out, no
>>
>>59973121
H
a
s
k e l l
>>
>>59973092
>>59973110

Who said I am using javacript for webdev?
>>
>>59973148
>generating 302598932758937258932759GB/s
>>
>>59973121
C#, friend.
>>
>>59973142
>using javascript outside of webdev
>>>/out/
>>
>>59973140
>generates garbage 1GB/s
>>
>>59973121
C++ is unironically the best option and it's not bad to work with once you've learned enough of it
>>
>>59973177
other languages generate 10TB/s
>>
>>59973188
Have you worked on a large team?
>>
What's the Big O of this implementation of Dijkstra? Quadratic or linearithmic?

void dijkstra(const Graph &G,const int &S,vector<int> &d)
{
d.resize(G.size(),INT_MAX);
priority_queue<pair<int,int>, vector<pair<int,int> >, Comparator> Q;
d[S] = 0;
Q.push(make_pair(S,d[S]));
while(!Q.empty())
{
int u = Q.top().first;
Q.pop();
for(unsigned int i=0; i < G[u].size(); i++)
{
int v = G[u][i].first;
int w = G[u][i].second;
if(d[v] > d[u]+w)
{
d[v] = d[u]+w;
Q.push(make_pair(v,d[v]));
}
}
}
}
>>
>>59972973
Sensory Memory: CPU Cache
Short-Term Memory: RAM
Long-Term Memory: HDD
>>
I'm curious: how would one go about making a simple window manager for windows? Are there APIs that support this?
>>
Anyone have any advice to writing a Java program that outputs MIDI files? I'm aiming for a random music generator side project sort of thing.
>>
>>59973256
>simple window manager
oxymoron
>>
do/can you guys code on drugs, prescriptive or otherwise
and what difference do they make
>>
>>59973256
You have to learn winAPI and work with window handles.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms633497(v=vs.85).aspx
is probably where you want to start. From there you get all the handles to the windows and you can extract their names or whatever. Using the handles you can set the window position dimension and flags given you have enough permissions. Install https://msdn.microsoft.com/en-us/library/dd460756.aspx too. It's very helpful for debugging and to gain an understanding of the windows window management.

I've had to do some generic window overlay for someones terrible idea once. It's not a good interface. Don't know anything about windows 8 or 10. Everything might be different.
>>
>>59973349
sorry, program
>>
>>59973140
Haskell is dead
>>
>>59973349
i only drink coffee

i think certain stimulants might be useful but it's very hard to justify using them over the long term (even coffee is of dubious value over the long term imo)
>>
ASM is a pretty specific language, jfc

whoever said it was easy?
>>
File: bathroomtiles.png (8KB, 742x193px) Image search: [Google]
bathroomtiles.png
8KB, 742x193px
>>59973349
SSRIs right now, they seemed to help for a while but I've recently hit a low point again.
>>
>>59973297
Learn how the MIDI file format works.
http://faydoc.tripod.com/formats/mid.htm
>>
>>59973393
not really
are you one of those idris memesters
>>
>>59973140
Too intelligent to use Haskell.
>>
File: crap.png (412KB, 1484x1704px) Image search: [Google]
crap.png
412KB, 1484x1704px
Im trying to voxelize a mesh, im clipping the mesh at different distances and render it off and on screens. On screen rendering with the framework provided flip() method works fine.
I have problems with off-screen rendering to texture. Pic related, red slices are the off-screen renders which have some artifacts compared to the green slices that are on-screen renders. The mesh is the voxel representation of the whole off-screen render of the stanfordbunny.

And this is the meat of the code. The on and off screen rendering setups are basically the same, except i change the framebuffer for off screen and generate a target texture. Any opengl gurus willing to point out the problems?

Mook wouldn't let me post code so i put it on pic related
>>
>>59973467
try a higher res depth buffer
>>
>>59973519
How?

I dont think the depth buffer changes anything, on-screen rendering works. Also the shader sets the pixel red if it sees a triangle, no matter how deep it is.
>>
>>59973586
>How?
in generateTexture3D

>the shader sets the pixel red if it sees a triangle, no matter how deep it is
so you don't have a depth buffer
>>
>>59973630
>so you don't have a depth buffer
nvm i'm not sure what you're talking about

you're rendering different slices and you don't want other slices to show?
>>
>>59973229
i think its cubic
>>
free MatLab™ compiler?
>>
I would want to learn Rust but I'm scared that Rust will die in the coming years
>>
>>59973670
You can't compile matlab. It's impossible. You have to embed a matlab interpretor.
>>
>>59973401
8086 is easy and comfy
>>
>>59973678
>Rust will die in the coming years
Something that's already dead can't die.
Nobody programs in Rust.
>>
>>59973229
linear?
>>
if you don't use exclusively write everything in lisp, then you are worthless.
>>
 1: ; AddTwoSum_64.asm - Chapter 3 example. 2:  3: ExitProcess PROTO 4:  5: .data 6: sum DWORD 0 7:  8: .code 9: main PROC 10:   mov  eax,5 11:   add  eax,6 12:   mov  sum,eax 13: 14:   mov  ecx,0 15:   call ExitProcess 16: main ENDP 17: END 


how come this results in visual studio lnk2001 error, and when I save and rerun the program after closing it, the error's gone?
>>
File: 1479883677181.jpg (143KB, 833x696px) Image search: [Google]
1479883677181.jpg
143KB, 833x696px
>>59973731
>>
>>59973701
In what universe
>>
>>59973414
Jesus fuck
>>
>>59972955
reply for DOD
>>
>>59973401
ASM is pretty easy imo just more tedious to write complex code with
>>
>>59973630
>>59973651
Sorry I missed out parts i didnt find noteworthy.
The commented out part in the drawMesh function calls glOrtho where i set the far and near planes, this basically will only show a part of the mesh, like its cut in half. Every slice i change the far and near planes distance to advance in the slices and show only that slice.

This i how i generate the texture:
        t = glGenTextures(1)
glBindTexture(GL_TEXTURE_3D, t)
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA8UI, w, h, d, 0, GL_RGBA_INTEGER, GL_UNSIGNED_INT_8_8_8_8, None)
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)

If you look at the butt of the bunny it is rendered okay, so the texture should be okay.

>i'm not sure what you're talking about
>you're rendering different slices
Yes.
>you don't want other slices to show
Thats sorted as i described above with glOrtho.
I dont want the artifacts (noise like on-off pixels) that appear on the red slices in my previous post pic. They looks like lines on the mesh representation of the voxels.

I am clueless, never seen this kind of errors before.
>>
I'm programming a telegram bot in python, and it parses icals it gets from a http link using the iCalendar package.

However, I noticed that by downloading from http, it doesn't get the latest ical. How do I get an ical from the webcal:// link as a file or as something to parse in python?
>>
>>59973229
First off, I'm going to assume you add something like:
...
set<int> visited {S};
...
while(!Q.empty()){
int u = Q.top().first;
Q.pop()
if (S.find(u) != s.end()) {
//process node
...
}
}

Then worst case your graph is basically* fully connected, thus you do O(n^2) pops total (first node pushes on n-1 nodes, second node pushes on n-2 nodes, ect), and since PQ pop is just delete(min), we get a total of O(n^2*log(n)) cost for popping all the nodes.
The for loop is only entered n unique times (due to checking the visited set), and does at most n pushes (at a cost of log(n) for insertion), which again gives n * n * log(n) or O(n^2log(n)). Thus total is O(n^2log(n)). Without the set, I'm fairly sure it's O(n^3), since for each n^2 nodes popped you must go through all n* edges each time.
*I put an asterisk here, because generally it's assumed you don't feed dijkstras anything but a DAG.
>>
>>59973879
try glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) in renderOffScreen like in renderOnScreen. now you're only clearing the color buffer in renderOffScreen
>>
>>59973953
Apparently you can implement Dijkstra's with a binary heap without decrease-key and still have it run in O(n logn). I can't for the life of me find an implementation of it.
>>
>>59974020
or try glDisable(GL_DEPTH_TEST)
>>
In VHDL, I'm working on getting a set of up / down counters for real time demodulation of a signal to communicate with a bus interface properly.

I've learned a lot about finite state machines in the past few days. Opinions on single process FSMs vs two process FSMs?
>>
For being a subreddit on 4chan /dpt/ sure hates any language that isn't mainstream and enterprise ready.
>>
>>59973188
*clears throat*
>>
>tfw retards are slowing down Rust development by conflating HKTs with type level lambdas
>>
File: 1468472224634.jpg (61KB, 990x557px) Image search: [Google]
1468472224634.jpg
61KB, 990x557px
>muh higher kinded types
>muh lambdas
>>
Make fmap map again.
>>
File: 1462665702458.jpg (36KB, 390x390px) Image search: [Google]
1462665702458.jpg
36KB, 390x390px
>>59974233
>it's another episode of anon being mad at what he doesn't understand
>>
>>59974030
>>59974030
Well I went and looked it up, and found this paper (which, interestingly enough, says always use NoDec algorithms for cache/IO reasons): http://www3.cs.stonybrook.edu/~rezaul/papers/TR-07-54.pdf
Gist of it is on page 17 figure 6 function B.2. Basically you maintain an array of current min distances for each node, and push on tuples containing (node #, distance) which it looks like you were trying in your original post. Then when you pop a node, you only do anything with it if the distance it was pushed on with is smaller than any you have seen so far. They go over the complexity on the same page, where m == E.
>>
File: 1490643432048.jpg (386KB, 1280x720px) Image search: [Google]
1490643432048.jpg
386KB, 1280x720px
https://doc.rust-lang.org/std/macro.include_bytes.html
>Rust actually has a standard and simple as fuck way to embed any arbitrary file into the program at compile time.

fn main() {
let foo = include_bytes!("foo.bin");
println!("foo = {:?}", foo as &[u8]);
}

foo = [192, 193, 194, 195]


C and C++ BTFO.
I don't know why other languages fail to support something as simple as this, forcing you to resort to stupid platform-dependent linker fuckery.
This is a big win for me.
>>
>>59974233
HKT's are fucking useless but don't shit-talk lambdas m8.
>>
>>59974271
I see they use a weight function in their implementation. Any idea what that is doing exactly?
>>
File: idris_book.png (175KB, 727x942px) Image search: [Google]
idris_book.png
175KB, 727x942px
So I've found the Idris book, it's a 10Mb pdf with awful text quality(because it's an OCR of the printed version and not the PDF edition), but it's quite readable. If anyone wants it, see http://rgho.st/6GR22Vd57 . I can upload it somewhere else.
>>
>>59973009
Why did the equal signs turn into asterisks?
>>
>>59974303
>HKTs are fucking useless
I think you mean "quantifying over HKTs is fucking useless", which is still pretty dumb. "HKTs are fucking useless" means you think every generic type is useless.
>>
File: gdsfs332.png (50KB, 822x604px) Image search: [Google]
gdsfs332.png
50KB, 822x604px
running this in R studio after changing the seed to 1234 made me get a very weird graph in question 8 part C. any idea what's causing this?
>>
>>59974311
I don't see a weight function (at least what I think of as a weight function). Are you looking at Figure 6, function B.2 (i.e. upper right corner of page 16?)
>>
>>59973414
Interesting.
>>
>>59974349
No, I mean higher kinded types are useless.
Everyday generic types aren't higher kinded.
>>
>>59974376
Functor is an everyday generic type
>>
>>59974376
If F<A> is a type then F is a higher kinded type.

Personally I don't really like the term "higher kinded type" because they aren't actually types. "Type constructor" or "type family" is better.
>>
>>59974386
Functors aren't higher kinded.
>>
>>59974364
Yeah, check the for each loop. There are calls to w(), which they say is a weight function
>>
>>59974421
In that case, Rust has HKT's then.
Why do people say that Rust doesn't have HKT's?
>>
>>59974421
F is just a function.
>>
>>59974422
FunctoR is.

>>59974421
It's a type term of a higher kind.
>>59974448
Type functions and type constructors are not the same.
>>
>>59974441
Rust doesn't have the ability to quantify over HKTs, which is what people typically mean when they say a language has HKTs.

>>59974448
Functions to types are also known as type families or "higher kinded types".
>>
Django. Want to make a blog with it for full control of customization. And once that done, rent a webserver and make a domain name.

Fuck Wordpress.
>>
>>59974465
>Type functions and type constructors are not the same.
That's not what coq say.
>>
>>59974467
What does "quantity over hkt" mean?
>>
>>59974467
And what does "quantifying over HKT's" even mean? give example that ISN'T in Haskell please.
>>
>>59974491
> give example that ISN'T in Haskell please.
template< template<> > in C++.
>>
>>59974488
The exact same as quantifying over types (what most languages' generics can do), just with HKTs instead.

>>59974491
// Foo is defined FOR ALL type families of kind * -> *
template<template<class> class F>
struct Foo {
F<int> bar;
F<float> baz;
}
>>
>>59974020
>>59974036
Tried both in every way, no change.

I also tried using GL_UNSIGNED_BYTE type texture, no change, but ill stick with this so im not wasting 4 more bytes on nothing.
>>
File: hkts.png (53KB, 581x668px) Image search: [Google]
hkts.png
53KB, 581x668px
>>59974484
It depends on the system, but to consider all systems you would refer to them differently.

I would use them differently anyway.

>>59974491
pic
>>
>>59974428
Ah ya sorry, I've been working with something else with weights. Those edge "weights" are basically the cost/value of the edge from u to v, so w(u,v) == Cost(edge(u,v)). Thus as they show, the (possibly minimal) cost from start node -> v, is the (minimum cost to get to u from the start) + (the cost of the edge weight (it it exists) from u to v), or in their code d[u] + w(u,v). We can then check to see if this is less than the currently seen minimial cost to get to v, d[v], and if it is update d[v] and (re)insert v with k = d[u] + w(u,v)
>>
Why is vim so fucking retarded?
why fucking paste aint working?
Why they cant make normal paste/cut/copy?
Why when i go to visual P, nothing happens?
>>
>>59974582
Works on my machine
>>
>>59974580
Ah right. Thanks man, you've been a big help. I was trying to work off the implementation in that very paper earlier, but the academic-vibe of the pseudo-code was a bit confusing to my simple, child-like mind.
>>
>>59974465
>>59974484
Type constructors don't compute to their definition, that's my take on it. Like newtype vs. type in Haskell.
>>
>>59974582
RTFM
>>
>>59974628
fuck your whore mother in ass faggot
>>
>>59972955
Poofag
>>
>>59974619
>>59974484

i'd put it this way

IdFun x === x
IdCon x =/= x
>>
>>59974606
it works when i try to copy something from vim, like from one file to another.
When i try to copy something from internet aint working
>>
>>59974612
It's no problem, good luck!
>>
>>59974670
Yeah, exactly. Though I think talking about computation in types is a little too much for /dpt/.
>>
File: 1487813337490.jpg (48KB, 1280x853px) Image search: [Google]
1487813337490.jpg
48KB, 1280x853px
>>59973121
>>59973165
>>59973169
>>59973177
>>59974166
>>59974233
>>59974284
Who are you quoting?
>>
>>59974716
whom*
>>
>>59974754
*who'mthre'ye
>>
>>59974716
Please stop posting spam
>>
>>59974534
Rust doesn't have generics that can accept genetics? That's sad.
>>
>>59974884
main2 :: MaybeT IO ()
main2 = do
smth <- pure (0 :: Int)
liftIO $ print (smth + 1)
>>
>>59974582
>>59974678
set clipboard=unamedplus
>>
I'm pretty good at Tcl and Python, advanced in Bash. What should my next language be? I'm thinking C or Java but I'd like to have some input.
>>
i'm sad /dpt/
>>
i posted this in /brit/ and they went absolutely mental
>>>/int/73810825

i thought it was completely reasonable, i don't even want to go into IT i want to be a software dev. do you think it was an unreasonable thing to say i don't want to settle for $48k?
>>
>>59974992
Fuck off you fucking faggot
>>
>>59974992
fuck off yank
>>
>>59974998
???????
>>
>>59974992
I don't understand what's your problem. Take the job, keep studying. Voila, you have job experience and a degree
>>
>>59975022
it's in the town she's moved to 1h30 away from where i live...
>>
>>59975013
Get the fuck off of this board

The website too
>>
>>59974992
Fuck off yank
>>
>>59974925
Well, this is they they're working on HKT.
>>
>>59974992
FOY
>>
Can somebody explain why I don't need to malloc if I do this?
char *string;
string = "lol";
>>
>Finished a core module in a 3 days
>Progress went faster than expected
>Now time to implement the functions from my messaging interface
>12/76 done after working all day today

Just end me senpai. I wish I had a pocket codemonkey to do all this tedium for me while I do the actual programming.
>>
>>59975133
Because the string literal "lol" is statically allocated. string is just pointing to it.
>>
>>59975133
The string is embedded in your compiled code, it will point to either somewhere in your actual binary when it is loaded into ram or some memory area managed by your kernel.
>>
>>59975133
the "lol" (plus zero terminator) string gets stored in the data section of your executable itself and the pointer refers to that location
>>
Java or C++?
>>
>>59974925
It really is. It should have been put in the language from the beginning so they wouldn't run into the problems they are having with adding it now.
>>
>>59975108
I think this is a good example of why you should create a language, and then the compiler. Not concurrently.
>>
>>59975180
neither
>>
>>59975160
what happens if you changed string to "foobar" by string = "foobar"?
>>
>>59975180
c++
how is this even a question?
>>
>>59975180
Ada. Simpleness of Java, power of sepples.
>>
>>59975180
for what?
>>
>>59975180
What do you want to do?
>>
File: 1479525480878.jpg (50KB, 720x720px) Image search: [Google]
1479525480878.jpg
50KB, 720x720px
how long is an instance of std::string in C++?
>>
>>59975189
Then string is pointing to another piece of static memory, "foobar".
>>
>>59975212
Which means "lol" is now lost and considered a memory hog, right?
>>
>>59975189
Implementation defined, tbqh
>>
>>59975212
really? i dont see why string would necessarily update and not still be "foo"
>>59975224
i could also understand this
>>
>>59975208
void* pointer, size_t size, size_t used I guess
>>
>>59975201
>>59975200

molecular dynamics and possibly a gui for said molecular dynamics. some code will eventually move to opengl or cuda
>>
>>59975180
compiling c++ in jvm byte code
>>
What would you use to describe something that is neither true or false? Some custom string?
>>
>>59975219
It was taking up memory the instant your executable was loaded into memory. It doesn't matter unless your string was huge, in which case the executable would be too.
>>
>>59975269
implementing trinary logic are we?
>>
>>59975269
an enum but it's likely not the best solution to whatever problem you want to solve
>>
>>59975234
string is just a pointer, your just changing where it points to.

>>59975224
No.
>>
>>59975269
std::unique_ptr<bool>
or
enum { yes, no, maybe };
>>
>>59973121
lisp is the answer, faggot
you can make static the norm with metaobject protocols
>>
>>59975182
It's mind blowing how the Rust designers could get so much right and then prioritize simplifying their compiler over making the language practical. Most languages can get away without HKTs, but Rust has lifetimes.
>>
>>59974992
FOY
>>
>>59975306
oh i misread what code he wrote there, thought they were 2 different variables
>>
>>59975133
A follow-up question from this
So why I can't do gets() without malloc then?
char *string;
gets(string)

code above doesn't work
>>
>>59975386
Perhaps because terminal input ISN'T embedded in your executable?
>>
reminder that programming in languages "closer" to the "bare metal" doesn't make you any better of a programmer.
>>
>>59975413
It makes you smarter.
>>
#define MAYBE_UNWRAP_INTO(d, x) \
do { \
Maybe<decltype(x.get_value())> __var_res_upx = x; \
if (!__var_res_upx.has_value()) \
return {}; \
d = __var_res_upx.get_value(); \
} while (0);

How would you rate the quality of this code?
>>
>>59975413
Thanks, your post was a valuable contribution to the thread
>>
>>59975433
>C++
0/10
>>
>>59974992
FUCK
OFF
YANK
>>
I don't know if the dude who was asking about the C/C++ preprocessor from last thread is in here, the one for:
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#define _MSC_VER 10
#ifdef _MSC_VER
const char* ver = "version: " STR(_MSC_VER);
#else
const char* ver = "version: " "unknown";
#endif

But if you are, I looked it up and the reason the two levels of indirection are needed is due to how the preprocessor expands its macro arguments. First it does a full argument macro expansion then substitution into the body, UNLESS they are stringed or concatentated, i.e. # or ##. Then after the first step, the macro body is scanned to see if any more substitutions could be made. Thus, for the above:
STR(_MSC_VER) = STR_HELPER(_MSC_VER) => Expand _MSC_VER to 10, substitute into macro body
STR(10) = STR_HELPER(10) => 2nd phase, Expand STR_HELPER
STR(10) = #10 => stringify 10
STR(10) = "10"

If we didn't have the second level of indirection, i.e. just STR(X) #x:
STR(_MSC_VER) = #_MSC_VER => This stringifies "_MSC_VER", its argument, and thus isn't expanded
STR(_MSC_VER) = "_MSC_VER"
>>
>>59975433
Macros are discouraged in sepples.
>>
>>59974992
if taking that job would mean you cannot complete your degree, then I wouldn't go for it. The American job market is not very friendly to people without degrees at the moment, and there's no sign of that changing.
If the job is still available after you complete your degree, and you haven't had any better offers, then it's worth doing until you find another opportunity. I don't know if working for the military excludes you from working elsewhere for some opsec reason, that's worth finding out.
Finally, do NOT buy into the meme that a STEM degree guarantees easy high-paying employment at graduation; you will earn higher over your lifetime, but the differences dont become significant until later in your career.
>>
File: 1417586339631.png (283KB, 512x384px) Image search: [Google]
1417586339631.png
283KB, 512x384px
>>59975449
>But if you are, I looked it up and the reason the two levels of indirection are needed is due to how the preprocessor expands its macro arguments. First it does a full argument macro expansion then substitution into the body, UNLESS they are stringed or concatentated, i.e. # or ##.
CPP was a mistake.
>>
>>59974716
My thoughts.
>>
>>59972973
Relly makes your hdd wroom wroom
>>
>>59975386
Because string isn't pointing anywhere, you didn't initialize string. It's the equivalent of asking why the following doesn't work as expected.

int i;
print("%d\n", i + 1);


In both cases, i and string, are uninitialized and their value is whatever garbage was in the automatic memory they were allocated.

So in the example for i, you're asking for ??? + 1.

In the case of string, you're asking to read input into ???.
>>
>>59975467
how would you implement this without a macro?
>>
in c, where is `int' defined? since this is platform dependend, the compiler should have a list for different platforms. but then, what about different compilers? or does posix define something besides minimum sizes?
>>
>>59975322
How does lifetimes affect Rusts ability to get away without HKT's?
>>
>>59975139
Sounds like a shit interface.
Redesign it.
>>
>>59975510
int is defined when the compiler is compiled, based on the platform you're programming on
>>
>>59975510
It's defined by the platform's ABI.
For example, for most 64-bit Unix-like systems, they follow the "System V AMD64 ABI".
http://chamilo2.grenet.fr/inp/courses/ENSIMAG3MM1LDB/document/doc_abi_ia64.pdf
>>
>>59975269
Option<T>
>>
>>59975500
>In the case of string, you're asking to read input into ???.
oh it's that simple, thanks!
>>
>>59975510
In the compiler, the requirements for int are in the C standard.

POSIX is a layer on top of C, it doesn't define what int is. The types defined by POSIX are done in header files.
>>
>>59975510
It's primitive.

>>59975513
The way lifetimes are used compared to types just makes it harder to write equivalent code without HKTs.
>>
>>59973349
Prozac made my mind feel cloudy. Would not recommend if you're trying to do anything that requires thinking. The worst part is that I didn't realize the Prozac was doing that. I got really angry at myself for not doing as well qs I could in a couple classes and couldn't figure out why. I changed my meds and its 1000% better.
>>
>>59975468
it's not a military job, it's just a job on base. i asked that same question on /dpt/ tuesday and these were the responses >>59959199

so now i'm a bit confused. i'm reading cracking the coding interview but if i should just work an IT job because software development is dead, then it'd be a lot easier for me in the now
>>
Bringing homotopy type theory to bare metal systems programming.
>>
What are you waiting for, /g/?

https://doc.rust-lang.org/
http://rustbyexample.com/

*Not for the brainlets*
https://doc.rust-lang.org/nomicon/
>>
>>59974992
wow, what a https://is2.4chan.org/g/1492641703341.jpg
>>
Why do people say choice of language doesn't matter? Are they stupid?
>>
>>59975861
[spoiler] iso standard [/spoiler]
>>
>>59975861
I'm waiting for HKTs
>>
>>59975861
I'm already comfortable with C++ and there's little benefit from switching over.
>>
>>59975926
C > C++ > Rust > D(ead)
>>
>>59975926
This. Name one benefit of Rust over C++ that doesn't involve:
>simplicity
>performance
>safety
>modules
>metaprogramming
>building
I'll wait.
>>
>>59973177
Other languages are just garbage
>>
>>59974538
well maybe you need a depth attachment for your fbo. that's the only real difference between your onscreen and your offscreen rendering. not sure how glOrtho etc works (it's deprecated as fuck anyway) but maybe it needs a depth buffer to work with
>>
File: QtBrowser.jpg (50KB, 641x648px) Image search: [Google]
QtBrowser.jpg
50KB, 641x648px
I want to create a "project explorer" type widget in my application. Would this just be a listview widget? Something custom?
>>
How do you get over slumps /g/?
>>
>>59973177
Y'all love to quote this "fact" about Haskell, but you give a free pass to other languages when people write bad code in them.

>"my Haskell code is generating a gig of garbage every second!"
Maybe your code is just shit, mate
>>
>>59975917
shit excuse
https://gist.github.com/14427/af90a21b917d2892eace
>>
>>59973177
GC time in GHC is proportional to the amount of live data. You can essentially make as much garbage as you want without consequences.
>>
>>59976021
Not good enough. Do it properly.
>>
I'm looking to learn Go by working on a project. Any ideas what I should do?
>>
>>59976021
Simulating higher kinded traits is meaningless when you can't quantify over higher kinded types.
>>
>>59976047
raycast a kernel compiler
>>
>>59976047
Multi threaded server type-thingie, that's kind of Go's thing as far as I know.
>>
>>59976047
Just skip straight to drinking whiskey, it'll have the same effect on your brain.
>>
>>59976047
write an ircd
>>
>>59976047
learn another language instead
>>
warning: no newline at end of file [-Wnewline-eof]


why is Clang autistic?
>>
>>59976114
does gcc do that aswell?
>>
>>59976127
no
>>
>>59976114
It is good practice to put a newline at the end of files.
>>
>>59976114
>newline at end of file
Absolutely haram
>>
>>59976114
that's actually part of the C standard
>>
>>59974534
seems extremely useful
>>
>>59976114
The C standard actually says that it should be there.
Also, why on earth isn't your text editor putting them there?
>>
>>59976139
Why good practice? Standard, yes, but that doesn't make it good.
>>
A thought: what sort of techniques do anti-adblock scripts use to detect adblockers, and could adblockers evade these by borrowing techniques from malware, such as polymorphic and/or metamorphic code?
>>
>>59976168
because then you can use
cat <file>
without issues
>>
>>59976197
Why doesn't cat just print a newline itself?
>>
https://youtu.be/dyI0CwK386E
This was a very good perspective on UB in C/C++. Glad I watched it. It elaborates a lot of ideas I've had laying about concisely.
Always feels good when you get that.
>>
>>59976208
>1 hour to explain UB

no thanks
>>
>>59976203
Why should it? That would be strictly less useful than its current behavior.
>>
>>59976214
>Needing 1 hour to explain UB

No thanks, c

FTFY
>>
>>59976226
Why should every file have an extra character instead of one program? Make it optional.
>>
>>59976208
>explaining undefined behavior
just learn assembly and use objdump/gdb on a few simple programs you write
>>
>>59976203
Because cat is just input -> output. If you ignore the intended purpose of concatenating files, it's almost a nop made for the bourne shell.

It doesn't and shouldn't change the input before it outputs it.
>>
>>59976214
It doesn't explain just UB. It explains a recent increase in complaints about UB, explains why you want UB from one pov. Why you wouldn't from another. And a third view that's that UB is a sign of people solving issues poorly/unintelligently within the C++ committee.
But I don't intend you to watch I just post things here to share because I don't have other friends to share with.
>>
>>59976265
That's true but it seems like giving every (text) file a trailing newline is just a bandage over the real problem of using the wrong program to print things.
>>
>>59976016
It happens when you have to generate a copy of the entire universe to just change a boolean.
>>
File: 1471048476195.gif (2MB, 1000x512px) Image search: [Google]
1471048476195.gif
2MB, 1000x512px
>>59976269
>because I don't have other friends to share with.
:(
>>
File: Untitled.png (38KB, 1590x382px) Image search: [Google]
Untitled.png
38KB, 1590x382px
>>59975133
It knows at compile time to store a string constant in a read-only section of memory that will be loaded and referenced at run time.
>>
Undefined behaviour is a fancy way to say "my type system sucks".
>>
>>59976226
cat could default to print with newline and have a no-newline flag.
>>
"my type system rocks" is a fancy way of saying "my language generates gigabytes of garbage per second"
>>
Is consolas the de facto font choice for real developers?
>>
>>59976292
It's not about that anon. It really isn't. Nobody thinks that.
>>
>>59976284
>It happens when you have to generate a copy of the entire universe to just change a boolean.
Well done on demonstrating your lack of understanding of Haskell/pure FP.
>>
>>59976311
>Nobody
I do
>>
>>59973169
> javascript acceptable for webdev
Everyone is using Typescript.
>>
>>59976309
>Microsoft
Hint: the answer is not yes
>>
File: no.png (10KB, 542x410px) Image search: [Google]
no.png
10KB, 542x410px
>>59976309
no
>>
>>59976318
Oh. Sorry, I was off by 1.
Happens all the time. UB is a way of communicating general language constraints though. Types are only tangentially related when the constraints are defined on specific types. It's the actual operations that have the UB.
>>
>>59976368
>off by one
Happens all the time in C. No worries.
>>
>>59976346
That f is disgusting
>>
>>59976378
for you
>>
>>59976378
that's not a problem, c11 is ugly anyway
>>
>>59976315
Sorry I'm impure for suggesting mutability as a means to getting shit done.
I should wrap myself into an IO action so as not to taint the world with my radical ideas.
>>
make off-by-ones great again
get rid of -fstack-protector today
>>
>>59976346
>programming videogames in videogamey looking fonts
What's a font suitable for database programming?
>>
>>59976404
t. brainlet
>>
>>59975433
>>59975449
>tfw to intelligent too understand preprocessor macro abuse
Is all real-world code like this?
>>
>>59976404
immutable data structures can share memory
>>
File: MAGA.png (6KB, 500x250px) Image search: [Google]
MAGA.png
6KB, 500x250px
make
>>
>>59975433
>do while 0
Anon you could have just opened a block right?
>>
>>59976431
no

>>59976447
https://stackoverflow.com/questions/9495962/why-use-do-while-0-in-macro-definition
>>
>>59975197
So what's adas bag? Is it viablr to use for modern app development? As in is it well supported, how big/what's the community like, tooling, third party libraries etc. I've heard enough about it that i feel like investigating, but I don't want to sink time into a toy language
>>
>>59976309
yes
>>
>>59976447
retard
>>
>>59975208
Is this like a subtle how long is a piece of string joke?
>>
>>59976309
I like Adobe Source Code
>>
>>59976368
>It's the actual operations that have the UB.
divide : Real -> (divisor : Real) -> (divisor != 0) -> Real

(divisor != 0) is a type inhabited only by its proofs. Without a proof you cannot call the function. The fact that division by zero is undefined doesn't matter since you can't possibly ask for it to happen in the first place.
>>
>>59976478
It was anything but subtle, anon.
>>
>>59975269
Schrodengers boolean
>>
>>59976457
Thanks.
>>59976469
>I'm a retard for not thinking about forcing people to add semicolons to the end of their macro
That's all it does.
>>
>>59976485
is this a real language?
>>
>>59976346
whys your font tearing?, are you using X or wayland?
>>
>>59976502
yes hasklel
>>
>>59975510
https://en.wikipedia.org/wiki/64-bit_computing#64-bit_data_models
>>
>>59975269
null
>>
>>59976505
>tearing
what?

i'm using X
>>
I'm writing some octave scripts and fighting procrastination.
>>
>>59975318
>runtime typechecks are just as good as compile time typechecks
>>
>>59976521
>octave
>not matlab

hmmm
>>
>>59975889
Because to true neck beards, language choice is trivial and largely irrelevant in the long run vs. how you think about and design the system
>>
>having typechecks at all
>>
>>59976509
reminder that the only acceptable language besides Rust is Haskell
>>
>>59973701

Cool, write me a routine to divide two 32 bit floating point numbers that are stored in hexadecimal.
>>
>>59976530
It's because I like free software and didn't really need anything that's in matlab but not in octave.
>>
>>59976517
sorry dumb joke, supposedly X does this

https://en.wikipedia.org/wiki/Screen_tearing

but ive never seen it
>>
>>59976538
>rust

https://github.com/rust-lang/rust/pull/25640
https://github.com/rust-lang/rust-buildbot/issues/2

kys
>>
>>59976563
well my laptop is old as fuck

and i'm running xubuntu 12.04

don't know if it matters or not
>>
>>59976502
It's valid Agda and Idris assuming Real, 0, and != are defined appropriately.
>>
>tfw want to program but it's already late in the evening and there's no mental willpower left
suffering
>>
>>59976565
>slave
does this word really offend blacks all by itself?
>>
>>59976584
>tfw have too write a ~1000 loc C program until friday night
>>
>>59976565
> paying attention to absolute drivel
typical brainlet
how's that python project coming along?
>>
>>59975971
I can play this game too.

Name one benefit of C++ over Rust that doesn't involve:
>[insert everything that C++ does better than Rust]
I'll wait.
>>
>>59976603
pretty good
>>
>>59976565
>issues/2
Does this imply that it was the second ever issue submission with the language?
>>
>>59976604
What does C++ do better than Rust?
>>
>>59976462
>Viable
Yes
>Well Supported
Yes
>Community
Small, but helpful
>Third party libraries
Surprisingly large, and GCC provides a c to Ada function to create thin wrappers for c libraries easier.
>>
>>59976604
>[insert everything that C++ does better than Rust]
that's pretty lazy, anon
>>
File: lisp.jpg (62KB, 740x220px) Image search: [Google]
lisp.jpg
62KB, 740x220px
https://en.wikipedia.org/wiki/Linguistic_relativity#Programming_languages

Will learning Haskell or Lisp cause my brain to expand to another dimension and make me smarter like when Amy Adams learned that alien language in Arrival?
>>
>>59976628
he can't name one
>>
>>59976618
Second ever issue submission with buildbot for Rust.
>>
>>59976630
yes
>>
>>59976594
It shouldn't. Humans have done slavery for millenia against all creeds and colours. Only Americans get pissy about it. If they were arguing against violent linguistic choices that'd be something I could get behind. Kids may be contributing.
>>
>>59976565
while we are at it, whitelist/blacklist needs to be changed
>>
>>59976565
>all white males
no surprise there
>>
>>59976636
Portability
Stability
Performance
>>
>>59976624
I don't know.

>>59976628
>Missing the point
The point was that you can't just make your argument by excluding everything that Rust might do better at than C++, you fucking faggot.

Also, how did you prevent your meme arrows from going green?
>>
>>59976649
what an amazing idea
>>
>>59976665
I hope you're in on the joke and just being ironic right now, anon.
>>
>>59976678
i'm in 5 levels of irony, rn
>>
>>59976489
I'll rephrase. Subtle for /g/
>>
>>59976649
This is far more problematic at least. There's clear color implications. And the original connotations of black/dark as bad is generally not opposed. It's universal.
>>
>>59976665
>>59976671
where did the satanic quads go?
>>
>>59976649
This would all be much simpler if English had grammatical gender.

Male/female form of white/black refers to a person
Neuter form of white/black refers to a non-person
>>
>>59976664
nice try, brainlet
>>
>>59976664
Rust has been stable for almost two years and it is generally faster than C++ (compare Servo to other browser engines, Leaf to other machine learning frameworks, etc.).
>>
>>59976705
t. pleb
>>
>>59976698
/Wdg/ stole them, much like it has potential programmers
>>
The Rust Code of Conduct
Contact: [email protected]

We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.

On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.

Please be kind and courteous. There’s no need to be mean or rude.

Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.

Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.

We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behaviour. We interpret the term “harassment” as including the definition in the Citizen Code of Conduct; if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don’t tolerate behavior that excludes people in socially marginalized groups.

Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the Rust moderation team immediately. Whether you’re a regular contributor or a newcomer, we care about making this community a safe place for you and we’ve got your back.

Likewise any spamming, trolling, flaming, baiting or other attention-stealing behaviour is not welcome.
>>
>>59976722
What's wrong with this?
>>
>>59976722
Would I get banned from Rust if my name is Ivor Biggun?
>>
>>59976728
It doesn't let me tell people that they're are faggots and that they should kill themselves. That's what's wrong with it.

t. rustfag
>>
>>59976375
kek
>>
>>59976741
>caring about people being gay
That's, like, pathetic, anon.
>>
>too brainlet to t. post correctly
>>
>>59976733
>we do not tolerate behavior that excludes people in socially marginalised groups
If your name is actually that you're probably socially marginalised because people think your name is a joke.
>>59976728
See above. They apply their rules unevenly. If they had uniform opposition to excluding people it'd be fine.
>>
>>59976767
My name is normal in Latvia but when I came to UK I was constantly mocked for it.
>>
>>59976756
>He thinks I'm actually targeting specifically gays
I should have the right to call anyone and everyone a faggot.
Just like how I'm calling you a faggot right now, faggot.
>>
>>59976556
if you're talking about hex strings, yeah fuck that.
>>
>>59976485
Yes there are languages that let you catch errors better than c/c++.
Doesn't change that it's the actual division by 0 that's leading to an illegal program state.
>>
>>59976776
>test
>>
>>59976767
Oh wow, I never caught that. Now I can see why some people might have a problem with Rust's CoC. That said, it only applies to official communities and not the language itself.
>>
>>59976630
>hasklel
lolno
>>
>>59976795
>Doesn't change that it's the actual division by 0 that's leading to an illegal program state.
Something that can never happen doesn't lead to anything.
>>
>>59976556
did you know that the 8086 doesn't support floating point arithmetic by itself?
>>
>>59976756
>Thinking faggot targets gays
I miss the 90s and early 2000s
>>
>>59976816
Agreed but it's not a generally applicable catch for all UB for the semantic operations defined in the language. Especially not in an imperative language that aims to be performing operations efficiently.
>>
>>59976788
                P
A
P T
A H
P T E
A H T
PATHETIC
A H T C
PATHETIC
A H T C
PATHETIC
A H T C
PATHETIC
H T C
PATHETIC
T C
PATHETIC
C
>>
Make the next thread have an image with that fag Alan Turing in the op.
>>
New thread:
>>59976956
>>59976956
>>59976956

>>59976882
Nah
>>
>>59976882
(as an anime trap character)
>>
>>59976834
>Tfw childhood innocence actually modified the meaning of hate speech into a ubiquitous term
Pretty based
>>
>>59976959
>just another anime-programming edit
Boring.
>>59976967
Yeah. I can get behind that. It's more fun than he generic trap programming meme.
>>
>>59976722
>Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
This kinda rubs me the wrong way. In MOST cases, there is a strictly best way to perform a task. It really feels like a cop-out, i.e. people don't HAVE to learn why something works/how to do something as good as possible, design trade-offs!11!!!
>>
>>59976981
>edit
No, I'm pretty sure it's real.
>>
>>59976996
>real anime reading real books
Come now anon. We don't need these delusions.
>>
>>59977017
It's an unmodified photograph of real objects.
How is that an "edit"?
>>
>>59977033
>anime is now photography and not drawings
Get help.
>>
>>59977054
Did you even look at the image?
>>
>>59977076
I may not see what you see anon. You're probably suffering from severe anime induced schizophrenia.
>>
>>59977094
Are you retarded?
>>
>>59977103
No need to get hostile anon. Just trying to help you.
>>
>>59973256
Pick up a copy of Charles Petzold if you want to learn winAPI
>>
I'm taking a c++ course right now. We're just barely learning functions and function prototypes. Can someone recommend me a programming project based on that?
>>
I want to create a program the measures the difficulty of reaching a key on the keyboard when your starter position is the WASD keys. How would I go about doing this? I'm in a C++ class and I'm barely on the functions section so I'm pretty new to programming.
Thread posts: 356
Thread images: 22


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

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


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