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

File: symbolics-keyboard-1.jpg (201KB, 2730x1131px) Image search: [Google]
symbolics-keyboard-1.jpg
201KB, 2730x1131px
What are you working on, /g/?

Previous thread: >>61639037
>>
Stop rewriting shit in JS
>>
File: lens library.png (836KB, 790x1200px) Image search: [Google]
lens library.png
836KB, 790x1200px
Has Haskell gone too far?
>>
>>61643934
No
>>
File: rmyt.jpg (18KB, 583x328px) Image search: [Google]
rmyt.jpg
18KB, 583x328px
>rub out
>>
File: 1403837987365.png (48KB, 400x389px) Image search: [Google]
1403837987365.png
48KB, 400x389px
>strike up conversation with random couple at festival
>turns out he's a programmer too
>immediately proceeds to turn the conversation into a penis contest to impress his girlfriend or wife

Him
>What do you work with?

Me
>Java currently

Him
>Ha!
>I used to program IBM AS/400
>You type in just code, real coding! no GUI!

I didn't stoop to his level even though I used to program embedded devices in C for a living.
Lesson learned: Don't even bother talking to programmers.
>>
>>61643934
Worse than all these esoteric Haskell "features" is the cruel C++ retards trying to ape them in C++2034 or whatever they're on now.
>>
If your languages C interface can't declare variadic function, pass struct by value to C function and receive struct by value from C function then your language is SHIT.
>>
>>61643984
It's a library, the real feature is RankNTypes
C++ will never (probably never?) have RankNTypes, same as D and other languages that are married to templates versus generics
Rust has some existential-esque stuff that might deal with this, dunno. Rust is a meme lang.

If C added generics in the style of void* with types (i.e. the same code, rather than templates that are copy/pasted code) then they could do this too
>>
>>61643982

Women ruin everything, including programming.
>>
>>61644017
i don't want this shite
>>
>>61643982
>>Java currently
I'd give you some shit too tbqhwu
>>
>>61644030
t. 1st year CompSci student

Yeah, I used to think everyone should be written in Assembly and/or C too
Then after the 2nd semester everything should be LISP or Haskell.
Then you get your first real job.
>>
>>61644022
then stop programming
>>
>>61644041
>t. 1st year CompSci student
>>
>>61644041
Everything *should* be written in Lisp or Haskell, but sadly it isn't.

Too many companies fell for Java marketing.
>>
>>61644047
stop infecting programming with esoteric mind-wank you thought up while on psychedelic research chemicals
>>
>>61644022
what's wrong with rank n types? it just lets you treat generics in a more first class fashion
>>
>>61644041
Most universities start teaching programming through Java though. Most 1st year CompSci students actually think Java is god and whatnot.
>>
>>61644086
We were taught C and two Assembly languages in the first semester. You had to translate C programs to Assembly and vice versa in the exam, on paper.
2nd semester was functional programming.
>>
>>61644076
keep your anti-intellectualism out of programming please
>>
>>61644085
it's just another not-really-useful language concept i can't be bothered to grok, probably crapped out by a category theorist

just like write program
>>
>>61644132
>not-really-useful language concept i can't be bothered to grok
Perhaps you don't think it's useful because you don't understand it
>>
>>61644132
Generics are good.
Do you agree?
>>
>>61644086
https://cacm.acm.org/blogs/blog-cacm/176450-python-is-now-the-most-popular-introductory-teaching-language-at-top-u-s-universities/fulltext
>>
File: 1492913983134.png (90KB, 780x402px) Image search: [Google]
1492913983134.png
90KB, 780x402px
>>61643982
Yeah, programmers tend to be pretentious, snobby assholes osure
Especially younglings, ugh. It's kinda weird, other engineers or science people I met are normal people

Don't be like that anons
>>
>>61644213
How depressing.

Given the attitude of most modern developers toward learning new languages, the future will be Python and JS.
>>
File: smug feel.png (32KB, 640x400px) Image search: [Google]
smug feel.png
32KB, 640x400px
>>61644041
>t. 1st year CompSci student
t. can't take a joke because he hates his job
>>
Is it always fine to represent a binary number in two's complement form and just add, in order to solve a subtraction problem?

It should be fine, right?
>>
File: tom cruise.jpg (54KB, 500x333px) Image search: [Google]
tom cruise.jpg
54KB, 500x333px
>>61644236
>OO language conference telling people that computers aren't magical
>>
>>61644129
i look forward to your paper on Rank 7 Collapsed Whistling Dickhole Cyclic Type Graph Topology Accessors. it's gonna be a killer pattern/language feature.

>>61644150
it's probably not very useful if i have not hitherto had occasion for it.

>>61644198
they have their uses sometimes. i don't reach for generics enough for their absence from a language (or a crap implementation of them) to be a deal breaker, though.
>>
File: 1496435150356.jpg (9KB, 267x181px) Image search: [Google]
1496435150356.jpg
9KB, 267x181px
>>61644252
You got me, lol

>>61644236
Yes, best to avoid the topic with most programmers IRL
>>
>>61644283
>it's probably not very useful if i have not hitherto had occasion for it.
You've been reimplementing it ad-hoc countless times. It's just like monads or any other FP concept, in a way. But it doesn't matter, I'm sure writing the same code over and over again is more pragmatic, at least until Java or C# adds it at which point it will suddenly become indispensable.
>>
>>61644273
kek
>>
>>61644283
RankNTypes basically means you can deal with generics in an almost first class way, i.e you can take, as a parameter, a generic function
>>
>>61644246
>the future will be Python and JS.
I don't really think that's fair. Python is nice as a learning language since it borders on executable pseudocode and makes itself very apparent that it's a layer of abstraction; learners eventually realize that they have more to learn after they figure out the language.
>>
>>61644329
>You've been reimplementing it ad-hoc countless times.
do you have an example, in concept or in code, of what would be considered a reimplementation of RankNTypes?

>at least until Java or C# adds it
i never use either of those.

>>61644332
>almost first class
>almost
wtf i thought this was supposed to be a silver bullet of a sort.

why doesn't it have a less esoteric name when used in the practical implementation of language features? why not "almost first class generics"?
>>
>>61643982
>let's settle this bitch right now faggot
>winner takes the hoe
>fire up hackerrank on your think pad
>nothing personnel, just programming
>>
>>61644388
>Python is nice as a learning language since it borders on executable pseudocode and makes itself very apparent that it's a layer of abstraction; learners eventually realize that they have more to learn after they figure out the language.
I've met way too many people who've become dependent on Python and its quirks. They struggle to use any other language that doesn't behave and look exactly the same way.
>>
File: 1307200900121.gif (57KB, 351x336px) Image search: [Google]
1307200900121.gif
57KB, 351x336px
>>61644409
>>
Any interesting python realted things I could work on? Had to learn it in first year comp sci, so no bully.
>>
>>61644400
>do you have an example, in concept or in code, of what would be considered a reimplementation of RankNTypes?
Yes.
>>
>>61644400
it's not a silver bullet because of complicated reasons

it's called rank-n-types because it means the types can have arbitrary "rank"
i forget the exact details

but anyway, it seems like you might want to be able to pass around generic functions as parameters, and manipulate them at runtime
>>
https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html
>>
>>61644400
>>61644443
if you want a silver bullet you basically want either dependent types or non-HM polymorphism
>>
>>61644443
not really.

>>61644465
sounds like more bollocks.

>>61644442
at last i truly see.
>>
>>61644481
So bollocks means things you don't understand? Got it.
>>
>>61644411
>They struggle to use any other language that doesn't behave and look exactly the same way.
So?
If they learnt some other (powerful) language they would behave the similar way.
>>
>>61644273
The guy who gives that talk is the antitheses of everything oop stands for. The entire talk is about abandoning oop for speed. He basically writes pure C, and regularly rips on people for using OOP.
>>
>>61644508
can you stop responding for me?
>>
>>61644511
It seems to happen at a much higher rate when the language taught is Python, in my experience.

It is regrettable that we do not start students off with Scheme and (Haskell or a dialect of ML).
>>
>>61644481
why not?
>>
>>61644411
>They struggle to use any other language that doesn't behave and look exactly the same way.
Being close minded is language independent, anon. There are still people who unironically develop modern software in raw x86 assembly because they're used to it.
Python is also harmless if it's used as a frontend to libraries written in a better language, so they can just go back to it when they know better, anyway.
>>
>>61644531
I'm only responding for myself.
>>
>>61644538
>Scheme
there's no need anymore
http://composingprograms.com
>>
>>61644553
>Python is also harmless if it's used as a frontend to libraries written in a better language, so they can just go back to it when they know better, anyway.
This just makes it worse. "Why should I learn any other language, if somebody else will just write a Python wrapper for the stuff I need?"
>>
>>61644538
>teaching freshmen haskell
that should be f u n
>>
>>61644560
can you at least tell him that you aren't speaking for me when you call him a fag for asking questions or being suspicious?
>>
>>61644578
I feel ill.

>>61644581
It is commonplace at many universities.
>>
>>61644580
>"Why should I learn any other language, if somebody else will just write a Python wrapper for the stuff I need?"

Well, that is a pretty good pragmatically-minded question. Why should they?
>>
I'm a webdev and I got constantly technical questions in python and java during job interviews

what the fuck
>>
>>61644591
I'm saying that his dismissal of concepts using various vulgar terms appears to be far more related to his unwillingness to grapple with them than to their utility.
>>
>>61644620
you could be a bit more diplomatic
>>
>>61644076
>he doesn't boof ETH-LAD and write Idris code during his ego deaths
>>
>>61644604
>Why should they?
Because Python is an extremely difficult language in which to create reusable abstractions and use them correctly, with very limited tool support, that leads to unnecessarily bloated and repetitive codebases, and has a tendency to produce many more bugs than other languages.
>>
>>61644632
Indeed I could.
>>
Whats the difference between web developpers and programmers?
>>
>>61644620
What fucking utility do they have?
>>
>>61644580
You're missing the point. They have to *want* to know more, you can't just force it.
>somebody else will just write a Python wrapper for the stuff I need
Well... that IS a pretty good question. Do you really want more wheel reinventors?
>>
>>61644660
Programmers don't get upset when asked to write code in interviews.
>>
>>61644660
The difference between electricians and physicists I suppose
>>
>>61644660
>in this itt we trigger /dpt/ to tits

No difference.
>>
>>61643982
just say you write lisp compilers for fun on the weekend


i mean, you do do that right anon?
>>
>>61644668
They enable you to write generic, reusable code and reduce the number of unit tests needed in your codebase.
>>
>>61644678
>>61644679
>be in job interview for frontend position
>first question on paper is about binary tree
>wat
>>
>>61644708
I once had to implement Huffman compression in a JavaScript frontend
You should know basic data structures in any case
>>
>>61644697
>generic, reusable code
ah yes, that meme ideal. in practice, no one tends to reuse code.
>>
>>61644433
Build a x64_86 assembly ide in python
>>
>>61644727
>no one tends to reuse code
Because most code written in popular languages is not actually reusable.
>>
>>61644708
How difficult could it be? Just answer ln(n) on each questions
>>
>>61644757
popular languages are obsessed with genericness
>>
>>61644772
They ruin it by not having referential transparency.

Also, first-order generics only get you so far.
>>
>>61644800
hahaha
>>
>>61644727
define "reuse code"
I use man of the same Haskell functions all the time, especially fmap, map, filter, (.)
>>
>>61644800
Julia lacks referential transparency, but it still does a pretty good job of getting code reuse out of its generics (better in practice, if not in theory, than most of the Haskell code I've looked at).
>>
If anybody can help me with this >>61643091
please, here is a cute cat.

>>61643144
The idea is that I can insert a new name any time I want, it's not a single stream of data I'm inserting once only.
>>
>>61644726
>Huffman compression

Even by technical interview standards, that's a bit of a weird choice of question to be asked.
>>
>>61644844
priviet tovarish, moi drug
>>
>>61644844
I love the cat.
>>
File: image.jpg (541KB, 767x1024px) Image search: [Google]
image.jpg
541KB, 767x1024px
>>61644252
too real...
>>
>>61644520
He's also retarded.
>>
>>61644041
I'm didn't do one year of programming yet.


What is all this Assembly vs LISP/Haskell about?
And what does it have to do with a programmer job?
>>
>>61643878
C++ is a shitheap
>>
>>61644844
Reminder to not reply to this


Variations of this "phonebook problem" are common in interviews to weed out the retards (i.e. literal drooling mongs)
>>
>>61644900
Why?
>>
>>61644041
t. 3rd year comp sci student
>>
File: smug pepe.png (69KB, 660x600px) Image search: [Google]
smug pepe.png
69KB, 660x600px
>sperg languages like Java are now okay because I'm forced to work with them (at low pay)

why didn't you just apply to real programming jobs, like C and C++?
>>
>>61644965
C++ is worse than java though
>>
>>61644933
t. bitter helpdesk support "programmer"
>>
File: smug pepe mouth.png (22KB, 418x245px) Image search: [Google]
smug pepe mouth.png
22KB, 418x245px
>>61644976
sure
>>
>>61644948
Have you read the OOP strawman and how seriously he took it?
>>
>One notable exception is Visual Studio, where, with default settings, every volatile write has release semantics and every volatile read has acquire semantics (MSDN), and thus volatiles may be used for inter-thread synchronization.
Fucking Visual Studio.
>John your code segfaults.
>Did you compile it in Visual Studio(TM)?
>>
>be smart programmer from thirworld shithole
>get job offer from USA
>try to enter country
>get asked about binary tree at immigration
>mfw need to return to my shithole now
>>
>>61645001
i bet you don't even know a quarter of C++
>>
>>61645028
man
i want to be that interviewer
>>
>>61645011
So MSVC has a better implementation than many neckbeard compilers.

That's good.
>>
File: 1499158142957.png (572KB, 563x706px) Image search: [Google]
1499158142957.png
572KB, 563x706px
Say something nice about the programming language above you
Then post another programming language

C++
>>
>>61645055
https://www.theregister.co.uk/2017/03/02/comp_sci_quizzes_at_us_border/
>>
>>61644844
State what you want to do with three sentences or less
>>
>>61645061
>making volatile variables memory fences is a better implementation
Use an actual memory fence and fucking neck yourself.
>>
>>61645065
Clean, fast and productive.

D
>>
>>61645034
enough for it to have been my last 2 jobs
>>
>>61645116
i.e, not enough to keep either
>>
>>61645034
To be fair, I doubt more than 100 people in the entire world know every nook and cranny of C++ and how to use it idiomatically.
>>
>>61645061
>neckbeard compilers
GCC hasn't been developed by neckbeards for like twenty years, and weren't developing Clang at any point.
Microsoft is a kingdom of mediocrity because it doesn't actually need to make good products to survive in the market. The smart people they hire, like the Scot that manages Haskell, don't actually benefit their major projects, because that would require stupid people to lose jobs.
>>
File: 1489980970724.png (245KB, 1000x935px) Image search: [Google]
1489980970724.png
245KB, 1000x935px
>mfw programming in C++
>>
>>61645087
>I am angry at implementation details that aren't even dictated in the standard

Keep programming your dumb hobby projects in your soon-to-be deprecated GahnooAnimeCompiler
>>
>>61645144
honestly

you really feel like you're a PROGRAMMER writing CODE
>>
>>61644041
things at your first job could have been a lot better than they are
t. second job
>>
>>61645144
That's brain cancer.
>>
>>61645091
Andrei Alexandrescu

Java
>>
>>61645152
Making brainlets upset is its own reward.
>>
File: premium think.jpg (30KB, 1400x800px) Image search: [Google]
premium think.jpg
30KB, 1400x800px
What's the most painless way to learn low level programming? Purely for educational reasons i.e. how computerz rly werk
>>
>>61645145
>I like embrace extend extinguish
>it turns me on
>i love it when john's code won't work right when compiled with gcc, clang, borland, mingw, or icl
>it's high class code and only works on microsoft's luxury compiler
>>
>>61644747
That doesn't sound like something worth doing. Would python even be capable of that?
>>
My constructor sometimes throws an exception in a lambda expression that makes new object and adds it to a list. Anyone have an idea as to why?
>>
>>61645288
python is the most capable language in the world, anon
>>
>>61645257
>borland
Does anything written in this decade even compile on borland?
>>
>>61645295
Are any of the functions you're calling throwing an exception?
>>
>>61645075
The main program is a simple code that opens up a file and adds one register at a time with a code and a name.

The code I posted, just reads up the file and prints all the names, organized by a code(each person has a code assigned).
But it doesn't seem to work like that.
Say I insert somebody with code "10", then another with 12, then 10 again.
I would want the program to list all the names with code 10, before the others.

Unless I insert them in that order, it won't do it.
>>
>>61645257
Who is "John" in this fictional scenario, and what is your relation to him?

If we are on the same development team, why are we using different compilers? Why are we using Visual Studio unless we are specifically targetting Windows? Why are we relying on undefined behaviour in our code, rather than using proper constructs?

Get a job, pedo anime watcher
>>
>>61645352
It's just a ctor and a list's add function. Inside the ctor are more lambda expressions that look for items based on the main item's id (basically a for each on a list that constructs a new list based on values from other lists that it finds through ids it has as data members).
The ctor itself just assigns the value to the variables, and the fucked up thing is that it works for some times but then on one items that has a null data members it throws an exception, even though it should just assign null to the data member.
>>
>>61645348
He tried to come up with some compilers that are actually used in the industry (unlike the neckbeard ones), but failed
>>
>>61645432
And what is the exception that's being thrown?
Do you have any minimal example that reproduces the problem?
>>
>>61645421
>pedo anime watcher
Did you forget where you are?
>>
>>61645442
Is GCC not a neckbeard compiler?
>>
>>61645463
a deprecated neckbeard compilers, yeah
>>
>>61645401
That seems like reasonable behaviour. So reorder the file after each insertion. Or read the whole file and order it in some container and read from that instead.
>>
Has anyone used type_traits yet for non trivial programs? How's the compile-time overhead?
>>
>>61645348
No of course not.

>>61645421
It's not undefined behavior if Microsoft defined it to have memory fencing semantics baka. It's definitely a proper construct if Microsoft rewrote volatile to fence memory.

You really are okay with Microsoft silently making code written in Visual Studio silently, subtly incompatible with every other compiler?

Random race condition caused crashes and subtle data corruption plaguing your application because some library that you downloaded and compiled was written and tested in Visual Studio, but you compiled it in ICL is acceptable behavior on Microsoft's part?
>>
>>61645485
Anything done recursively will kill compile times.
>>
>>61645527
Nope. You're the one relying on implementation specific details not dictated in the standard.

The standard exists for a reason. If you are too much of a dumb retard to get that then boo hoo.

Next you'll find out that MSVC has its own calling convention in x64 and threw cdecl, stdcall etc. out the window. What a shock you'll be in for.


Kill yourself anime watching pedo
>>
>>61645669
>Kill yourself anime watching pedo
Is that supposed to be an insult? LOL
>>
>>61645470
>So reorder the file after each insertion


The question is how?
I guess I could do it, if I was working with arrays, but how do I reorder a whole file?
>>
>>61645739
you're unwilling to load the whole thing into memory?
>>
>>61645067
they're reading into a joke way too hard
>>
>>61645739
Loop through the file to find the insertion spot. Move each subsequent entry one step down.

It's easier to just load the whole thing.
>>
>>61645759
Load the whole file into an array, order it, then print it on the file again?
I could do this, only if there isn't an easier method.

>>61645783
Alright.

>Move each subsequent entry one step down

That seems like an option, why would it be easier to load the whole thing?
>>
>>61645898
>That seems like an option, why would it be easier to load the whole thing?
might be less fiddly. see if you can work it out, though. actually, doing it both ways it probably a good exercise
>>
>>61645442
>>61645469
>gcc isn't used in the real world
what sort of event-horizon-for-dweebs enterprise fizzbuzz hell dimension do you live in
>>
>>61643903
I've always wanted to have that space cadet keyboard.
>>
comfy sunday coding in C and assembly
#include <stdio.h>

void main(){
char sentence[]= "HELLOWORLD";
printf("%s\n", sentence);
for (char* c = sentence; c < sentence+10; c++){
*c += 0x20;
}
printf("%s\n", sentence);
return;
}

section .data
Input db "HELLOWORLD"

section .text
global _start
_start:
nop
mov ebx,Input
mov eax, 10
Decapitalize:
add byte [ebx], 0x20
inc ebx
dec eax
jnz Decapitalize
nop

section .bss
>>
>>61646073
I wonder how much it'd cost to reproduce them, or at least copy the general design.
I'm guessing the Hall effect keys wouldn't be cheap.
>>
>>61643982
I literally don't even do dick measuring contests, unless it's either at my opponent's behest to entertain their frustration, or against a strawman of an absent contestant as a way of validating someone else's gripes with that person (as is presently the case).
I have two modes, either I'm better than you and I want to use my knowledge and experience to help you become better than me, or you're better than me and I am pleasantly impressed and take no issue with it.
I just honestly don't understand how people can take a competitive or otherwise aggressive approach to life and other people. It seems so petty and pitiable, but beyond that it just seems completely unrelatable. I just don't get what they're going for.
>>
>>61646082
>printf("%s\n", sentence);
>not puts(sentence);
>>
>>61645180
Easy to find people who know Java

Haskell
>>
>>61646082
Why 32-bit x86 in 2017?
>>
>>61644012
>variadic functions
Variadic functions were a mistake. They result in needlessly bloated code in order to support a feature that in most cases simply isn't used. If you need functions with a variable number of arguments, just pass in a pointer to an array.

>pass struct by value to C function
This is a good feature to have, but it's rarely a good idea to actually use. The only benefit is that it implicitly copies the struct so you can use it to store intermediate values without modifying the original, but mutating arguments inside a function is just plain bad style, any copying should be explicit. Passing structs by value is only beneficial for very small structs (i.e. doubleword or smaller), and even then you're probably better off serializing them to and from machine words.

>recieve struct by value from C function
Just plain bad style. All standard x86 calling conventions pass return values in the accumulator or ST0, anything too big to fit in two registers has to be returned via an invisible pointer, and at the C level, all pointers should be explicitly visible. Out parameters are a far better way to return large structs from functions.
>>
>>61646277
i'm using 64-bit? just because you have the entire rax/rbx register doesn't mean you have to use it. eax refers to the lower half
>>
>>61646140
Been wondering that myself.
Similar keycaps have been successful but I want all the functionality.
>>
>>61646333
You're loading the address of Input into a 32-bit register, which only makes sense if your program is running as a 32-bit process.
>>
>>61646391
assembled with NASM for the elf64 format so i don't know w hat you're on about. i did nothing special to make that run on my 64 bit machine
>>
>>61646169
Noncompetition as a lifestyle is a pretty effeminate pledge. You're probably a fag.
... My god I just realized.
Gay faggots "don't even do dick measuring contests" because they WANT to be the one with the smaller dick, so they can receive.
It all makes so much sense now.
>>
File: anim.webm (459KB, 1366x768px) Image search: [Google]
anim.webm
459KB, 1366x768px
i made some decent progress on my program today, what do u think
>>
>>61646469
gay men actually have bigger penises than straight men on average
>>
>>61646469
>Noncompetition as a lifestyle is a pretty effeminate pledge.
As much as I dislike competition, this is true. Comp, conflict are vital to get gud path
>>
>>61646455
It might be guaranteed to work in this case since your program is smaller than 4GB code + data, so virtual memory can guarantee it doesn't need any addresses that won't fit in a 32-bit register. But the assembly source doesn't have anything specific to AMD64, it could build and run just fine on IA-32. Even if you assembled it to 32-bit ELF, it should run on 64-bit machines, since AMD64 includes a 32-bit compatibility mode.
>>
File: wat.jpg (70KB, 757x346px) Image search: [Google]
wat.jpg
70KB, 757x346px
Working with python for the first time and this just happened.

Da fuq?

Is there a non-stupid guide to virtualenv and importing dependencies without having to apply them system wide?
>>
>>61646480
looking good
>>
>>61646515
JUST RUN THE FUCKING COMMAND THE COMPUTER SUGGESTED

JESUS CHRIST
>>
>>61646515
what shell are you using? maybe it didn't update $path or something
>>
>>61646515
Check your $PATH.
>>
>>61646513
ok so to write it in the proper 64 bit assembly style anyways i'd change eax to rax, why are you berating me over writing 32 bit in 2017 if you know it doesn't matter
>>
>>61646515
pip installs to ~/.local/bin/
You have to add that to your $PATH

or run pip as root to install a package globally
>>
>>61645948
Close enough then, thanks anon.

One last thing: how would you suggest I move each entry down?
This still assuming I don't work with arrays.
>>
>>61646612
I'm not the one who said writing 32-bit in 2017 was a bad idea, I'm just pointing out that your assembly source doesn't depend on any of the new 64-bit features.
>>
>>61643903
Nothing, I'm a bum. 3/4 through a very shit android game, but before I move on I'd have to go back and fix the Android look and feel, which I hacked to pieces initially. I'd still have to fix the scoring mechanism and the game thread doesn't close correctly (considering it's fucking signal based with no kill switch). It's also java so the potential for bloat is always there.

I also want to add some new sprite graphics/animation and I need to finalize the sound mix (which is also buggy as fuck in my implementation because the music/effects classes in android suck a large cock)

I could probably do it but have zero motivation.
>>
>>61646233
Pure functiona style and safe multithreading.

Common Lisp
>>
File: path.jpg (20KB, 558x119px) Image search: [Google]
path.jpg
20KB, 558x119px
>>61646620

Ah yeah there it is.

You use $HOME in path right? Like this?
>>
>>61646626
That's the fiddly part. Start from either end of the section you want to move down. Starting from the top: Save entry i+1, move entry i to point i+1. Save entry i+2, move the saved entry i+1 to i+2. Et.c.
>>
>>61646735
doesn't matter unless you expect your $HOME to change and .local/bin to follow
>>
>>61646735
Yes, that's correct, remember to open a new shell

In my opinion every distro should include ~/.local/.bin/ in the users' $PATH because it's become standard in the last few years
>>
>>61646770

It still didn't work
>>
>>61646626
I want to say, though, your real problem is trying to figure out why you thought your original code would print the entries in sorted order.
>>
>>61646293
>Out parameters are a far better way to return large structs from functions.
Yeah lets completely destroy any chance of optimizing these functions by pointer aliasing.
Any modern compiler does RVO well enough that you shouldn't ever do out parameters. You can do input output parameters if you like, but not just out parameters.
>>
>>61646823
Check ~/.local/bin/
is there a virtualenv executable?
>>
File: 20.jpg (31KB, 960x720px) Image search: [Google]
20.jpg
31KB, 960x720px
teach me about C pointers, i just dont understand them
>>
>>61644684
that's not impresive at all, lisp is a pretty easy language to parse.
>>
File: pointers.png (9KB, 317x350px) Image search: [Google]
pointers.png
9KB, 317x350px
>>61646860
Got it?
>>
File: term.jpg (122KB, 918x569px) Image search: [Google]
term.jpg
122KB, 918x569px
>>61646857

Yes, this is a new terminal window

I'm just gonna install globally, screw this
>>
>>61646860
You'll understand pointers once you learn they act like pointers.
>>
>>61646744
Seems the same as arrays, maybe even a difficult way to do the same as with arrays, I wouldn't even know how to move around entries in a file like that.
Thanks, I think I know what I will do then.

>>61646831
It's sorted by the name's code.
I thought it would go through the whole file reading only the code I assigned to the int value inside the void function.
>>
>>61646917
My bad, I should have looked closer
Your PATH definition depends upon the condition that ~/bin/ exists

Change it back to how it was and add below
PATH=$PATH:$HOME/.local/.bin/
>>
>>61646169
how about both?

>>61643982
the programming community really has become that though. any conversation will turn into whether you use vim or emacs or whether you're frontend or backend, or whether JS or python or C or C# are real languages. the same mentality gangsters have as to who is a 'real' gangster and who is not.
>>
>>61646928
Did they name pointers pointers because they point of did they make pointers point because they're named pointers?
>>
>>61646965

Still no.

Stack suggest .bashrc stuff but I don't have one.

Gonna have to fix this one later
>>
>>61643903
What does the "Rub Out" key do?

If I press it, will I be motivated to rub one out?
>>
>>61647060
They named them pointers because they point.
They used to be just called addresses and are still in low level languages
>>
>>61647060
In the early stages of Computer Science people used to allocate in memory other memory location to reference to them. So they called it pointers.
Then pajeets invented std::unique_ptr
>>
http://cslibrary.stanford.edu/104/
>>
>>61647101
>Then pajeets invented std::unique_ptr
That makes me wonder, what's the ethnical composition of the C++ comittee?
>>
>>61647137
https://isocpp.org/std/the-committee
I can't find them. They may be writing the standard while white the people are taking the photo.
>>
>>61647172
>They may be writing the standard while white the people are taking the photo.
scary thought
>>
>>61647120
Magic wand of dereferencing.
>>
>>61646860
Pointers are a type of variable that contain an address in memory. Evaluating then normally returns that address, and dereferencing them (*) allows you to operate on the actual data at the address it contains. Each data type in C has a pointer type, including the pointers themselves, technically allowing you to have an infinite nest of pointers (though generally you should never go beyond double nested). These types, i.e. pointer to int, exist instead of a general purpose pointer type so the compiler knows what data the pointer is actually pointing to.

If you are confused about how they work, it's most likely because C's syntax for pointers is a little obtuse.
>>
>>61647120
Explanations like this makes me question why people find pointers hard.
>>
i love pointers
>>
File: 1345083005912.png (10KB, 131x160px) Image search: [Google]
1345083005912.png
10KB, 131x160px
>>61647286
>mfw function pointers
>>
>>61647137
https://www.youtube.com/watch?v=CPgxw1EzC54
>>
File: 9780262033848.jpg (82KB, 420x475px) Image search: [Google]
9780262033848.jpg
82KB, 420x475px
Is this the best book to have some decent algorithms skills and knowledge?

Or it is too much?
>>
>>61647402
its the bare minimum actually
>>
>>61647402
i don't like it because it doesn't give the reader much guidance. this is not to say that there are clearly better books out there
>>
>>61647402
best book would be Knuth, but good luck ever getting through it
>>
>>61647425
people are going to take one look at those code examples and scram
>>
File: .png (60KB, 619x911px) Image search: [Google]
.png
60KB, 619x911px
>>61647425
It's not that bad.
>>
File: 1396928603311.gif (996KB, 245x183px) Image search: [Google]
1396928603311.gif
996KB, 245x183px
>>61643903
I regret getting into TDD.
The number of online resources for doing TDD with cmocka is too damn low.
Nobody will even answer my SO questions anymore.
Google searches return nothing but bug trackers, mailing lists from 5 years ago, and my own lonely posts.
I just want to kill myself and be reincarnated as a webdev so I can have the luxury of watching 10+ hour long youtube series on node and
npm install SolutionToEveryProblemImaginable
>>
>>61647571
>I regret getting into TDD.
Good. It's a pretty bad idea.
Some TDD shops write more test code than actual code. And their software isn't anywhere near spacecraft proof code.
>>
>>61646293
>Variadic functions were a mistake. They result in needlessly bloated code in order to support a feature that in most cases simply isn't used. If you need functions with a variable number of arguments, just pass in a pointer to an array.
void * args = malloc(sizeof(int) + sizeof(double));
int a = 5;
double b = 2.5;
memcpy(args, &a, sizeof(int));
memcpy(args + sizeof(int), &b, sizeof(double));
printf("This is a good idea %i%f\n", args);
free(args);

You should be on a language committee
>>
As a beginner is it okay to make programs that "Just werk?"
>>
File: 1501013554646.jpg (178KB, 1280x720px) Image search: [Google]
1501013554646.jpg
178KB, 1280x720px
How does Facebook program a system to hold 2 billion user at the same time?

Can PHP do all that?
>>
>>61646293
>support a feature that in most cases simply isn't used
The C function that is used the most is a variadic function (printf family). Passing an array to a function like that just isn't ergonomic at all, especially since the types of the arguments can be different.
>>
>>61647762
Simplified:
printf("This is a good idea %i%f\n", {5.0, 2.5});
>>
>>61647834
It almost certainly uses a database management system.
PHP COULD do all that, but that's not what it's made for. PHP really isn't even meant for real server side work, ideally its job should be to delegate tasks to other server side software capable of handling them more securely and then incorporate the results of those tasks into an HTML document before it's sent to the client. It shouldn't really be trying to take care of the heavy lifting by itself.
>>
>>61648066
I don't know anything about PHP except memes I read on the internet: The Post
>>
>>61648086
Why don't you enlighten me, anon?
>>
>>61647834
PHP couldn't do that so they had to invent their own VM for PHP that could handle all that crap. Also fuck ton of load balancing.
>>
File: 4coin.png (11KB, 220x126px) Image search: [Google]
4coin.png
11KB, 220x126px
Made an ugly timer thing which counts down when a 4chan window is focused.
I can buy more 4chan time by "inserting coins" by pressing the "+" button. I can earn coins by doing useful stuff.
If the timer goes below 0 it'll yell at me by spamming notifications.

Rate my autism
>>
>>61648188
if you like it, that's what matters
>>
>>61648188
Combine that with the writing code level up program another anon wrote and you got yourself a productivity tool.
>>
When working on something like a game that has multiple "scenes", different menus and the game overworld, inventory windows and a map for instance. Is a Finite State Machine the way to go? I understand the basic concept of it, but getting one state to tell the machine to switch to another state seems impossible, but required to get to get my game to work properly
>>
>>61648188

That's actually pretty neat

I was considering something similar to this like that pomodoro shit

What did you write it in?
>>
>>61648086
>I am angry because I think somebody is wrong. However, I am too stupid to formulate an argument yet too arrogant to hold my peace
The Postâ„¢
>>
Does anyone have the programming projects info graphic where it color codes them according to difficulty?
>>
>>61648256
Python with tkinter
>>
>>61648246
Yeah. Here's how I do it in my game:
(define world-context (list
(lambda ()
(set_relativemouse #t))
handle-inputs/world
(lambda ()
(set_relativemouse #f))))

(define (handle-inputs/inventory yaw pitch mouse-dxs mouse-dys x y z dx dy dz)
(give_player_coordinates (+ x (/ player-width 2)) (+ y (* 10/11 player-height)) (+ z (/ player-width 2)) pitch yaw)
(if (letter_pressed #\q) (program_running #f))
(if (letter_pressed #\i) (switch-context! world-context))
(when (and indebug? (letter_pressed #\p))
(repl))
(values yaw pitch mouse-dxs mouse-dys x y z dx dy dz '()))

(define inventory-context (list
(lambda ()
(inventory-grid-alter/all! inventory x: 0 y: -0.74)
(inventory-grid-alter/all! inventory-below x: 0 y: -0.74))
handle-inputs/inventory
(lambda ()
(inventory-grid-alter/all! inventory x: 69 y: 69)
(inventory-grid-alter/all! inventory-below x: 69 y: 69))))

(define (switch-context! newcontext)
((caddr context))
((car newcontext))
(set! handle-inputs (cadr newcontext))
(set! context newcontext))
(define (run yaw pitch mouse-dxs mouse-dys x y z dx dy dz framenum)
(when (program_running)
(poll_events)
(receive (yaw pitch mouse-dxs mouse-dys x y z dx dy dz cursor)
(handle-inputs yaw pitch mouse-dxs mouse-dys x y z dx dy dz)
(update-blocks! (caddr world))
(if (not (null? cursor))
(set_cursor #t (car cursor) (cadr cursor) (caddr cursor))
(set_cursor #f 0 0 0))
(client_framesleep)
(run yaw pitch mouse-dxs mouse-dys x y z dx dy dz (modulo (+ framenum 1) 60)))))

Each context is 3 function pointers tied together. An init function, the function called every frame, and the cleanup function.

The world context makes the mouse invisible when it starts and visible when it closes. The inventory context causes the inventory to be drawn on the screen when it starts.

I haven't really done much with the inventory context so it's short enough to actually post. But you can see how I switch.
>>
A * x + B * sqrt(x ^ 3) - C * exp(-x / 50) - D = 0


^ what does the exp(-x/50) part mean here? i assume exponent, but which term is to the power of the other?
>>
>>61648246
In my game every "scene" is basically a GUI element and I toggle visibility as needed and the main game is basically rendering to FBO that's then displayed in "image" UI element. It's not horribly inefficient (getting 700~ FPS in my shitty game on 8 year old hardware) so I guess it's not that bad solution.
>>
>>61648342
based scheme poster
>>
>>61648348
e ^ (-x / 50)
>>
>>61648405
ok. thanks. hope that's right. wondering why he didn't just type that instead...
>>
>>61648342
Thanks for the explanation, I hadn't considered function pointers but that might be a good idea.

>>61648364
I'll consider this as well, performance isn't a concern for me since there's no physics or the like

Thanks xers
>>
File: window.webm (498KB, 640x436px) Image search: [Google]
window.webm
498KB, 640x436px
strong encryption peer to peer chat in ncurses and openssl. this is the ncurses interface beginning
>>
How do I cross compile for windows using SDL and mingw? Been having a lot of trouble with it.
From what I've looked into I need to actually install sdl for mingw or somehow link my copy of SDL to mingw but I'm not really sure where or how to do that.

x86_64-w64-mingw32-g++ -static -o app.exe app.cpp -lSDL2
>>
Trying to write a class in C++, that takes animation data from a file, and inputs into my animation system. I've never done anything like this before, does anyone have some advice or resources for me?
>>
>>61648512
Don't use that garbage memelang.
>>
>>61648482
It should look for the lib by default in the mingw's lib folder rather than your global lib folder for the host toolchain so you basically just build SDL with mingw and install afterwards and the linker should be able to find it.
>>
>>61648512
>>61648525
>>
>>61648471
nice dude! i hope it turns out well
>>
>>61648525
>>61648580
Using it until Jai comes out.
>>
>>61648512
We're gonna need a lot more info. 3D? 2D? Should literally just be as easy as opening the animation data file into memory and giving a pointer to the object. If it's just raw data that should be it. Is it in a specific file format? Compressed? Come on dude.
>>
>>61648594
>No RAII
>>
>>61648621
That is a good thing.
>>
>>61648593
<3
>>
>>61648628
No it isn't. RAII is the only sane way to handle manual resource management.
>>
>>61648628
Use C in that case then
>>
>>61648649
>Muh implicitness and hidden state changes
No thanks.
I bet you think dynamic typing is a good idea.
>>
>>61648594
Literally what is Jai going to change besides being the first modern gaymen-centric language?
>>
>>61648447
How were you thinking about implementing the states?

The command pattern is basically dolled up function pointers anyway.
>>
>>61648611
Sorry, I'll elaborate.
It's 2D, the actual file is as follows.
: animation_idle
IDLE 32 32 0 0 10 2 0.2f

: animation_run
RUN 32 32 0 64 10 1 0.1f


This represents two animations, the first line on earch of them is what the animation should be called so I can reference it in the code. (Something like m_animation.SetAnimation("animation_run"))
The second line (IDLE for example) is the state which it should be assigned to, and the numbers are just data on how to find the frames of the animation within a spritesheet.

This is poorly thought out as you can probaly tell, but I really have no frame of reference with this.

The whole problem really is, I just have so little experience with this sort of thing, and don't really know where to start.
>>
gopher server coming out well! right now its a standalone file but i think i'm gonna make a library out of it.
>>
>>61648671
It's not implicit if it's a documented side effect. Having to explicitly declare every detail is incredibly error prone. If you want that, you should be writing in assembly or C.
>>
>>61648685
https://www.youtube.com/watch?v=gWv_vUgbmug
>>
File: vomit.jpg (90KB, 650x650px) Image search: [Google]
vomit.jpg
90KB, 650x650px
>>61648700
>side effect
>>
>>61648709
No, give me your personal reasoning for wanting to try Jai.
>>
>>61648725
Looks real neat, and compile time is super fast. But I'm not really that great of a programmer. I'm just a fan of J Blow, and I'm pretty keen to try this language.
>>
>>61648709
Why would I trust a guy whose sole documented experiences programming are lightweight indieshit games to design a language intended for high performance applications?
>>
>>61648720
Side effects are only bad if they touch state that you are also messing with directly (or that influences other constructs in unexpected ways). The whole point of RAII is that resource management is never directly touched by the programmer, but rather abstracted away using object lifetime. The problems of side effects don't come into play because the state is encapsulated and the programmer can treat it as being one and the same with object lifetime.
>>
>>61648757
So what do you mean by "lightweight"? And how does that apply to Braid and The Witness?
>>
Anyone here that uses MSVS and NuGet?
This shit is driving me crazy.

I added a few dependencies through NuGet but I get all sorts of linker errors but adding the dependencies manually seems stupid if you use the package manager especially given the directory structure that NuGet uses.

What gives? Am I missing something obvious?
>>
>>61648694
I'm no expert in game/media programming or OOP itself really, but you really should look into using a standard data language like YAML or JSON to store the data. It might seem like overkill, but imagine having hundreds of animations to manage, and then you're on your own because you decided to use your own format for data storage. If your system ever needs to expand with additional metadata per frame, you won't have to reinvent your own parser. The fun part about this is after you've perfected the data storage you can make your own tools to edit the data with this standard format.

As for the problem itself, I would probably make a parser that caches all the animation data, so you could fetch say an array of size n with name of x from a cache. It's as simple as it sounds. Whether you want to make a new object type just for animation data is up to you. You might make it inherit from say a "YAMLParser" class so different types of data can easily have access to loading from that format. Depending on the size of the game, you may or may not want to cache everything in memory at the start, at the start of each level, at use time, etc. This is all things you'll have to decide for yourself.
>>
>>61648743
lmao
>>
>>61648786
They don't stretch the boundaries of what computers can do. So we have no evidence that he can design high performance applications and that he knows what goes into designing high performance applications.
>>
>>61648725
Not anon but I find so many situations where the metaprogramming JAI (or lisp) provides would just be golden.
Right now I can only get some approximation of that in Lisp or I'll have to write my own text processing tools for it.

I also enjoy the priorities of the language and the way he motivates the decisions he makes. It gives me confidence in the languages future. I disagree on some things like the way he treats constructors and destructors (right now anyway).
>>61648757
You have no idea who Jonathan Blow is then, he's a prominent figure in the game dev community since the early 00's.
Regardless, most languages are made by people with no significant projects behind them. If you've looked into braid it's not a simple project, and that's ignoring The Witness.
>>
>>61648822
Thanks a lot, I'll take a look at using standard data language, since creating tools like you mentioned sounds like fun too.
>>
>>61648851
>If you've looked into braid it's not a simple project
>>61648831
>>
>>61648851
Huh, Johnathan Blow browses 4chan.
>>
>>61648743
>I'm just a fan of J Blow
This is what worries me the most about its release.
There's a lot of those people. If you read the youtube comments most of them are completely clueless people when it comes to programming and can't even understand half of what he's saying in the demo videos.

That applies to /dpt/ too in the small instances where I've seen people comment. But it's more understandable because most of you aren't even employed.
>>
>>61648863
No, the other way around. That second guy is wrong.. damnit
>>
>>61648851
>he's a prominent figure in the game dev community
You've literally made two games, one which was wildly overrated because it was still the early days of indie games, and the other a pretentious wankfest of trite logic puzzles.

Fuck off JBlow.
>>
>>61648889
We're talking about him right now. Wouldn't that be proof that he's at least a little bit prominent?
>>
>>61648907
literally who?
>>
>>61648925
>Dart is shit and dead
>Dart confirmed relevant again!
kill yourself.
>>
>>61648889
>I'm a consumer
Gee. What a surprise you don't know anything about the internals of an industry.
He's been writing columns for GDM back when that was alive if you want the more public side.
Just because games is something where programmers get held up as front figures for the projects sometimes doesn't mean they should be judged by those merits.

Just the same you wouldn't judge a faceless Apple/MS developer as worthless because he has 'never done anything major'. Along with most programmers of course.
>>
>>61643903
powershell to scrape craigslist job postings that match my criteria and email my resume.
>>
>>61648907
Well considering that he apparently astroturfs himself as a brand, it's artificial.
>>
>>61648936
>be a decent programmer but shitty everything else
>you're just a consumer!

Alright jon, its time to get off.
>>
sprintf without variadic functions could be solved like this:
typedef struct Formatter {
size_t max_len;
char* dst;
char* dp;
const char* format;
const char* fp;
} Formatter;

Formatter* format_int(Formatter* this, int x) {
...
}

Formatter* format_float(Formatter* this, int x) {
...
}

char* format_finish(Formatter* this) {
char *dst = this->dst;
free(this);
return dst;
}

Formatter* snprint(char* dst, size_t max_len, const char* format) {
Formatter* fmt = malloc(sizeof(Formatter));
...
}

int main() {
Formatter *fmt = snprint("Foo %d %f\n");
format_int(fmt, 123);
format_float(fmt, 45.6);
puts(format_finish(fmt));
}


Huge added bonus:
You can easily add custom formats, simply by defining new format_foo() functions.

No variadic magic necessary, more versatile.
>>
>>61648936
if you wanna post and talk about what you're up to, Jblow, that's fine desu. You aren't the first game dev to post on 4chan. Don't pretend to be someone other than yourself when defending yourself though. It's really unbecoming.
>>
how's his programming language going
>>
>>61649032
That's fucking stupid.
>>
I'm working on a Win32 C program which uses multithreading. Just a little question: if I create a data structure in the main thread, will the children threads be able to directly access it as it happens when you work with processes and do a fork (in Unix at least, dunno in Win), or do you have to pass them as arguments to the thread functions?
>>
>>61649061
How do you add custom formats to sprintf?
Really curious.
>>
>>61648864
A bit flattering but no. I certainly consider myself a worse programmer.
>>61648863
>They don't stretch the boundaries of what computers can do. So we have no evidence that he can design high performance applications and that he knows what goes into designing high performance applications.
He knows plenty of people who do high performance programming and he's done The Witness.

The state of high performance game software right now is quite tragic though. They're really just C programmers that have to compromise with a performance hostile environment called the C++ programming culture.

But it's not like it matters. If you can't see why the language is a good fit for games as it is now you probably won't ever get it or even need to get it. It's not a language that appeals to the broadest possible audience like Java did.
>>
>>61649070
>will the children threads be able to directly access it
Yes, but you need to be aware this this can cause issues if it isn't done properly.
>as it happens when you work with processes and do a fork
forked processes get their own copy of the program's memory, so any changes they make will not affect the parent program.
>>
>>61649032
>...
You never show how you intend to call format_* or derive them.
I don't see how you could possibly add more custom formats by
>simply by defining new format_foo() functions.
You'd need to alter the snprint function, have some crazy trickery where you automatically fetch the function pointers of the new custom format function or do some AST/macro processing.

I don't see why you dislike variadic functions. Unless your solution is very elegant and I don't see it.
>>
>>61649085
You don't. Write a function that spits out a string or just reach directly into the structure and reads the members; it's generally more useful that adding some hacky layer on top of printf.
Your "solution" requires multiple function calls, requires heap allocation and is just solving something which isn't even a problem.
>>
Is C a good languange for video game deving?

How much of C does transfer to C#?
>>
>>61649188
>Is C a good languange for video game deving?
No

>How much of C does transfer to C#?
basic syntax
>>
>>61649115
Okay, what I mean is: can I simply access the variable as if it were declared in the thread's body or do I have to pass a pointer to it? Don't worry about concurrent access, it's a data structure I made myself to work in a concurrent environment with semaphores and everything.
>>
>>61649179
He doesn't like them because writing them is a little hard.
>>
>>61649188
>How much of C does transfer to C#?
Most of it. But there's a lot more stuff in C#
>Is C a good language for videogame deving
Only parts of serious videogame deving. Likely it's not what you're looking for.
>>
>>61649197
Yes you have access to all globals in a separate thread.
>semaphores and everything
Be careful! Semaphores aren't a magic bullet solution to race conditions. They create performance bubbles.
>>
>>61649197
You can't access another thread's local variables unless you pass a pointer to it.
They can all access global variables just fine directly.
>>
>>61649200
>writing them is a little hard.
Only a little. As far as I can tell this would be a nightmare unless you're gonna continually extend the snprint function, which is fine.
Of course this version is just fine for implementing the basic printf. Slightly more onerous on the call site though, imo.
>>
>>61649188
C is the freaking basis of VG development. You talk about C# because Unity is made of it, but Unity's core is made in C++, which is an extension of C and for practicing which I totally recommend to learn C before. Plus, Unity is for simple unoptimized games and it's fine to just script in C# and let it do the dirty job, but when you want to make heavier games, for which engines like Unreal are more suited, they all use C++ even on a user level. This is because C and c++ have manual memory management and grant finer grain precision which means better performance if you know what you're doing, while languages like Java or C# are highly unoptimized as they have a garbage collector which does everything by himself in a not so clear and non-reliable way.

So, learn C. Everyone should start with C.
>>
>>61649205
>>61649196
Thanks, you guys are the best!
>>
>>61647834
It couldn't with PHP version 5, so Facebook made their own implementation called Hack, which got beaten by PHP version 7 again. So the answer is yes.
>>
>>61649224
I know lock free is faster but I really couldn't find a real way to implement it safely in plain C (also because I have to stick to C99 for some compatibility issue) and it's a little Overkill for this shitty job.
>>
>>61649260
Learning C will teach him bad habits that shouldn't be used in modern C++. So he should learn C++ first.
>>
>>61649289
I mean, it's just a school project and I've wasted a lot of time on it, plus professor doesn't care if we optimize it more by using lock free
>>
>>61649185
>requires multiple function calls
inlined by the compiler
>requires heap allocation
can be easily rewritten without heap allocation

Then the net overhead over snprintf is zero.

>>61649179
>You'd need to alter the snprint function
Then snprint function only initializes the Formatter struct
Actual parsing is handled by the format_ functions
>>
>>61649299
But he's talking about C#.
He shouldn't learn either.
He clearly doesn't want this.
>>61649188
Anon please don't listen to them. If you want to make a game find an engine you like and work with that.
>>
>>61649289
>also because I have to stick to C99 for some compatibility issue
I'm sorry anon.

If you cared, you could do inline assembly though.
>>
>>61649307
>inlined by the compiler
You can't guarantee that. Compilers typically won't inline functions over a certain size, and I can imagine that most "to string" functions would be over that.
Also, it just makes it more of a pain in the ass for the programmer, which is what I was actually getting at.
>>
>>61649197
C99 and below don't define threads in any reasonable extent. All non-stack memory is shared between threads in practice.

Accessing global state is problematic though. Even if you pull out all the tricks to make your accesses on global state safe you may still end up having false sharing because of how globals happened to be laid out in memory.

It's much easier to only operate on state passed in by pointer or constant globals you're aware that you won't ever alter.
>>61649289
>lock free is faster
Not always. Sometimes using a semaphore is correct because your alternatives are bad.
>>
>>61649307
Anon I suggest you implement this scheme in a limited capacity and compare it to a limited sprintf.
>>
>>61649299
>Learning C will teach him bad habits that shouldn't be used in modern C++. So he should learn C++ first.
Got it totally backwards. Vectors, smart pointers, exceptions, inheritance, templates, constructors, and destructors are abominations.
>>
New thread:
>>61649395
>>61649395
>>61649395
>>
>>61649398
I feel the same way. Are we luddites anon?
>>
>>61649424
Nah. Most people who write high performance C++ use none of those things (maybe templates, rarely). People end up trapped in C++ due to decisions outside of their control

People who are writing C++ and aren't writing high performance C++ are making a terrible mistake
>>
What's a good resource to learn C#, coming from C++?
>>
File: huehuehue.png (30KB, 831x713px) Image search: [Google]
huehuehue.png
30KB, 831x713px
I'm working on a bookstore application that communicates with a text file. I'm currently trying to check the price of a book that exists inside the text file.

I want to iterate through the file but every time I run my readRecords() function; which is supposed to return the value of fscanf, I only receive -1.

In every other aspect of the whole application I get the return value of 5; which is the amount of arguments I want to scan.

How do I fix this?
>>
>>61649517
I think googling this will give you better more unbiased answers.
Also I feel the overall amount of C# programmers in /dpt/ is fairly low.
Between functional programmers, C programmers and the general hate for OOP you're not gonna find many people who have gone down the road you want to follow.
>>61649557
>how do i fix this
Post it in the next thread.
>>
>>61649361
I'm using Windows CreateThread and other WinApi shit. Anyway I'll pass it, it's a little effort
>>
>>61649517
Msdn for everything Microsoft including C#
>>
Currently working on better understanding NAT hole punchthrough, putting my old digital ocean server that used to host my teamspeak to good use, once again.
>>
>>61650149
What's the cutie in the pic?
Thread posts: 327
Thread images: 32


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

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


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