[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: 313
Thread images: 24

File: 1438104299776.webm (1MB, 490x614px) Image search: [Google]
1438104299776.webm
1MB, 490x614px
https://www.youtube.com/watch?v=j2vTStG6Yys

There is nothing wrong with frogposting edition

Previous thread: >>61073559

What are you working on, /g/?
>>
How do i make a makefile that compiles sources from src dir to objs dir and links those to a file in $(TARGET) dir?
>>
First for shotas
>>
File: C++ coming out.jpg (113KB, 600x1005px) Image search: [Google]
C++ coming out.jpg
113KB, 600x1005px
C++ is for substandard programmers (aka C rejects)
>>
File: 1478137031854.png (59KB, 1762x302px) Image search: [Google]
1478137031854.png
59KB, 1762x302px
LLVM backend has FAR too much required reading.
I don't want to write a C or C++ compiler.
What is the easiest way to get C and C++ code compiled to a custom architecture?
>>
>>61076140
GCC is worse, writing your own is worse.
Just git gud.
>>
>>61076150
>Just git gud.
At what?
Using LLVM? Writing my own compiler?
>>
>>61076165
At RTFM
>>
>>61076178
Way too long.
>>
>>61076129
use something like cmake if you can
>>
File: okay.jpg (1MB, 5000x228px) Image search: [Google]
okay.jpg
1MB, 5000x228px
>>61076117
Working on parsing using boost::spirit.
>>
>>61076186
Then just give up now, if you're that lazy you're going to give up eventually.
>>
File: C++ coming out.jpg (25KB, 400x426px) Image search: [Google]
C++ coming out.jpg
25KB, 400x426px
>>61076193
>POOst
>>
Where can I learn C++? I know all the basics and principles of C and know Java and C# along with some obscure languages.

Which resource should I use to learn c++? Any meme website or do I have to read a 500 page book?
>>
>>61076197
No, that much required reading just to make a backend is very unreasonable.
The interface really should not be that complicated.
>>
>>61076140
>LLVM backend has FAR too much required reading
I'm afraid programming isn't the right thing for you.
>>
>>61076215
>Compilers should not be complicated
Well sweetie, feel free to fork TCC and see how many thousand times slower it is.
>>
>>61076189
cancer
>>
>>61076140
>custom architecture
>expecting to get spoonfed
just read the things you fag
>>
>>61076215
>The interface really should not be that complicated.
It really isn't, I'm afraid you have some misconception about what's happening in a compiler's middle and back-ends.
>>
>>61076214
Well written C++ is merely C with RAII and maybe templates or move semantics.
>>
>>61076224
The compilation is much faster.
>>
>>61076226
Make is cancer, cmake is chemo. It hurts and the syntax is literally poison, but it'll save you in the long run.
>>
>>61076226
if gnu make is any less of a cancer then do you know the answer to >>61076129
>>
>>61076214
>Where can I learn C++?
In garbage containers
>>
>>61076245
That's just stating the obvious.
>>
>>61076214
I struggled with this question for a long time.

Honestly, I think reading 500 pages out of Stroustrup's 1300 page book and keeping it around for reference is really the best option.
>>
>>61076224
Anon stop twisting her words. Clearly she's saying the interface to llvm shouldn't be that complicated and I agree.
I think the problem is that the person who wrote the required reading list is expecting a dedicated person to get into it. While anon is expecting a tutorial of sorts because she's doing it for fun.
>>
>>61076266
>the interface to llvm shouldn't be that complicated
Yeah I agree! You should just be able to type
llvm::MakeCompiler(this->magic);
>>
>>61076239
Yeah that's the common use.
It's a garbage environment to be in. But it's the realistic use.
>>
>>61076216
>>61076230
>>61076237
http://llvm.org/docs/WritingAnLLVMBackend.html
http://llvm.org/docs/LangRef.html
http://llvm.org/docs/CodeGenerator.html
http://llvm.org/docs/TableGen/index.html
http://llvm.org/docs/WritingAnLLVMPass.html

And take note of the size of each page.
Sorry, but that's way too unreasonable. LLVM is a bloated piece of shit, I don't have time to waste on this. I want to work on my VM and write an operating system for it.

At this point I will be spending waaaaay more time writing a fucking backend than actually implementing the VM and OS.
>>
File: C++ coming out.jpg (5KB, 265x190px) Image search: [Google]
C++ coming out.jpg
5KB, 265x190px
>>61076265
>reading 500 pages out of Stroustrup's 1300 page book
Typical C++ "programmers"
>>
>>61076266
>a tutorial of sorts because she's doing it for fun
There literally is a tutorial about using LLVM. The guy is just illiterate. Which only furthers my opinion that programming isn't made for him.
>>
>>61076140
Maybe this'll give you some inspiration http://compilers.iecc.com/crenshaw/
>>
>>61076266
Did you just assume my fucking gender?
>>
>>61076280
>I want to work on my VM and write an operating system for it
>At this point I will be spending waaaaay more time writing a fucking backend than actually implementing the VM and OS
Well you just have no clue.
>>
>>61076273
Then you clearly don't agree with me anon. That's ludicrous. How can you even imagine an interface like that? Where did you even convert your AST to their expected format?
Stop being such a useless programmer. Go play with Javascript, Scratch or something.
>>
>>61076280
News flash dipshit, you need a C compiler for your incredibly awfully designed CPU architecture and buggy as shit operating system to be anything more than a waste of time.
>>
>>61076280
>I don't have time to waste on this
then why are you using a custom architecture and making a VM and an OS this is like the biggest time sink you could possibly have
>>
Challenge:

Implement the fibonacci sequence with the tree recursive solution but avoid exponential time and ensure it's total for all terms.

Haskell, Agda, and idris may NOT be used for this... bonus points if you can say why they are banned from this challenge.

Test cases:
fib(10);
fib(100);
fib(50);
fib(1);


Good luck
>>
>>61076294
No, just your normal gender.
>>
>>61076294
We don't accept male programmers here. So yes.
>>
>>61076303
So you're the one who's too lazy to understand modern compilers and their requirements and I, as the one who can actually use LLVM, am useless.
>>
>>61076280
Just do what I did: Don't use C, make a small lisp instead.
>>
>>61076310
Do your own homework
>>
>>61076323
>can use llvm
Clearly you can't if you think that's what the interface should be. It's just a terrible api with no flexibility. It's useless.
>>
Any good books on functional programming? I'm learning Erlang/Elixir. Seems easy enough to work with, but I'm having trouble approaching problems from a functional perspective.
>>
>>61076305
I know that, fucking idiot.
My original question was what is the easiest way to get a C compiler to target my architecture, because I'm not interested in the compiler side of things.

>>61076309
Because I want to design and implement my own architecture and platform, and write an OS for it. I like low level programming, It's fun, I've written a few VM's before.
I just hate compilers.

>>61076329
I am thinking about making my own C-like language designed for my architecture (don't want to read the C and especially not the C++ standard), since it would be easier to parse and generate code for.
Maybe I should, It would probably take less time than dealing with LLVM, and would teach me some new things.
>>
File: rip.jpg (330KB, 800x680px) Image search: [Google]
rip.jpg
330KB, 800x680px
>generate_single_cell_regression_training_input
>>
>>61076356
http://haskellbook.com
https://github.com/bitemyapp/learnhaskell
>>
>>61076381
>i don't want to write a compiler but i need a compiler guis
write a compiler you fucking mongoloid
>>
>>61076323
>So you're the one who's too lazy to understand modern compilers and their requirements
The guy you are responding to is not me
>>
>>61076381
Parsing and making a lisp in general is much easier and you will have a more standard (implementing the R7RS is piss-easy) and flexible language, this is why I suggest it.
While making a C is possible, and quite easy if you use something like bison, it will not be quite lacking while still more difficult to implement.
>>
>>61076339
It's not homework, I teach programming so thought I would see how "good" /g/ actually can be as so far it's mostly fizzbuzz.
>>
Post your sock to leg ratio
>>
>>61076427
I've never used lisp and not interested in using it. I like C syntax, I like the imperative/procedural way of doing things.
No thanks.
>>
>>61076280
"I want to do [x] big thing, but I don't want to put in the proportional work required to achieve [x]"
Maybe you should hire someone.
>>
>>61076463
Homosex faggot
>>
>>61076140
Look at the suckless c compiler it's under 10kloc C.
Or just steal someones hobby C compiler that's written in some nicer language and modify it for your platform. There's really no need to write the compiler in c.
>>
>>61076450
teach me daddy
>>
C isn't a shit language.
C programmers are shit, though.
Seriously, guys, brace abstractions. There's no fucking point to implement your own shit for the 1000th time. Well documented black boxes is the fucking point of programming.
>>
>>61076117
Back to ribbit
>>
>>61076511
>avoiding bad abstractions
Not the same thing as
>implementing your own shit over and over
You write it once. You control it. You can copy it all over.
Since you control it you can make changes to it. You make your own perfect api to the system. And you've actually abstracted constructively. Unlike people who #include <algorithms>
>>
>>61076289
Thanks, I'm going to give this a go.

>>61076501
>suckless
Last time I looked at the source code of one of their programs (st I think), I nearly vomited, no thanks.

I don't really want to steal someone elses project either.
It's either a backend to an existing compiler framework, or just simply design my own simple language and write a compiler for that.
I think I'm going to go with the latter.
>>
>>61076511
Most C libraries are way too opinionated, they are either not maintained or fucking huge.
>>
>>61076548
Because you're such an amazing programmer that your implementation is proven to be more efficient, more bug free, and more generic than something that's tested against literally millions of codebases.
>>
>>61076575
>than something that's tested against literally millions of codebases.
>thinking that most libraries are tested
Also when it comes to C most libraries are just for platforms that support POSIX. I try to write portable software
>>
>>61076603
Poor library support for a particular platform is a legit reason to roll your own, and that goes for any language.
But that is not C-culture.
>>
>>61076548
Found the guy who rolls his own linked list implementation
>>
>>61076140
The Plan 9 C compilers are very easy to retarget. Until very recently, the Go project used and maintained them. Maybe they still do -- sniff around the source code.

Also, lcc (literally called "a retargetable C compiler") and tcc.
>>
>>61076531
I'm not afraid to it's just that it's a big topic.
>Java is what most would call oop today.
I suggest reading this site a little
http://wiki.c2.com//?FirstClass

I don't know if Java has first class objects or not because I haven't used it. I know C++ doesn't though. It should give you a good idea of the situation though.
>>
>>61076575
Stop using GLib.
>>
>>61076652
>In ObjectOriented languages such as CeePlusPlus, objects are FirstClass
Your own sources seem to disagree with what you're saying.
>>
>>61076575
>more generic
That's a problem though. Solutions that aren't specialized are potentially more inefficient, difficult to use or error prone than a specialized solution.
If you write code well you find a middle ground and then specialize a little for a specific use case.
>>61076642
I practically never use linked lists. They're almost useless. It's fairly impressive how rarely they fit a situation.

And to both of you. If you don't have any requirements on you don't bother replying. What's the point in arguing with you if you don't need anything and are free to write code that's as inefficient as you like? C programmers have requirements. Of course it's not the best language for programming on hypothetical machines running in the ether. Mathematics is the best language for those.
>>
Getting really tired of the repetitive strain of pressing shift, especially when working with camel case.

Is there any ease of access feature that will, if you hold down a key for X milliseconds, replace the character you're typing with its shifted counterpart? Am I just going to have to resort to autohotkey?
>>
>>61076720
A hashmap is always going to look the same no matter what types you put in it. The only differences are the hash and comparator functions.
sepples templates are perfectly suited for such data structures.
>>
>>61076737
In fact I guess I'll try remapping the held-down-for-X-milliseconds space bar to shift.

>>61076764
Sepples templates aren't perfectly suited for anything.
>>
>>61076671
Languages vary as to what isFirstClass. Some, such as theCeeLanguagehave only basic types (ints, pointers; in particular, arrays are not trulyFirstClassthough the array/pointer equivalence lets you fake it in most situations). InObjectOrientedlanguages such asCeePlusPlus, objects areFirstClassbut classes are not, while inSmalltalkLanguageorRubyLanguage, for example, all references including references to class objects areFirstClass. InFunctionalProgramming, functions areFirstClass.
--end quote
I can't be expected to argue with someone who can't even read.
>>
>>61076720
> Solutions that aren't specialized are potentially more inefficient, difficult to use or error prone
Potentially inefficient, sure. Keyword here is potentially. Examine the performance characteristics and see if it's 1) sensible, and 2) meets your requirements.
But more difficult to use and error prone than rolling your own? Ehhhh.
>If you don't have any requirements on you don't bother replying. What's the point in arguing with you if you don't need anything and are free to write code that's as inefficient as you like? C programmers have requirements.
Sure, if you have requirements a library isn't meeting, go for it. But C culture seems to be roll their own regardless of requirements, eventually gathering up a huge personal library of buggy, largely untested, half-implemented algorithms and data structures.
>>
>>61076797
>InObjectOrientedlanguages such asCeePlusPlus, objects areFirstClassbut classes are not

>>61076074
>They have the double indirection right there and they could give us first class objects. They explicitly went against that for some reason

C++ has first class objects. You said they didn't, your sources say they do.
I'll give you the benefit of the doubt and assume you meant to write first class classes the first time.
>>
>>61076764
No. Obviously not. Sometimes you want to pair the keys and the values. Sometimes you want to store an array of the keys and separately allocate the values. Sometimes you want them to use reference counting on the values and have a way to invalidate the keys.
There's tons of variations.

Templates can do anything. They're not well suited for this case. Even if you just wanted to alter the types they're a very messy way to write that compared to writing functions where the syntax let's you specify compile time determined type with say a character.

I don't see who could think templates are perfect if they're not the most unimaginable programmer ever.
>>
>>61076861
A lot of that could be achieved with wrapper functions/classes.
>>
>>61076892
what joy

>>61076848
examples
>>
>>61076853
I see the confusion. But first class objects is a general way of expressing first class-ness. You can say a function in functional programming is a first class function. Or you can say it's a first class object. It's not an object in the OOP sense though.
You'll find it all over. I suppose I should have said first class classes for greater clarity.
>>
>>61076892
>let's hack our general implementation to work well for our use case
Do you not think there's perhaps a better way to do this?
>>
>>61076928
When you need specialization, use specialization.
>>
h = h*33 ^ c;

Which hash function is this?

>>61076140
Use qbe
https://c9x.me/compile/
>>
>>61076853
>C++ has first class objects.
no
>>
>>61076945
It doesn't? Really?
>>
>>61076558
>steal
kys
>>
>>61076939
I need specialization a lot. Most applications do.
It's just that this >>61076892
Kind of thinking obscures the fact. Tons of simple applications become complicated this way.
>>
>>61076941
isn't that k&r
>>
>>61076310
unsigned int fib(unsigned int n) {
return fib_(n, 0, 1);
}

unsigned int fib_(unsigned int n, unsigned int a, unsigned int b) {
if(n < 1) return a;
else return fib_(n - 1, a + b, a);
}
>>
>>61076928
Because instead of writing only a few LOC to get the behavior I want on top of well-tested underlying implementations is inferior to writing multitudes more code when 80% of it ends up being doing the same exact thing.
>>
>>61076997
And the stack blew up
>>
>>61077021
Basically you're saying that when you write specialized code you do it unnecessarily.
That's not very smart anon.
>>
>>61077031
implementation defined.
>>
>>61077031
At fib(100)?
Weak ass system.
>>
>>61077037
wat
>>
File: coder.jpg (88KB, 274x1040px) Image search: [Google]
coder.jpg
88KB, 274x1040px
look what I found
>>
>>61077031
How?

It should take at most ~100*7*4 bytes, so ~2.8 KB
>>
File: shot0033.jpg (310KB, 1920x1080px) Image search: [Google]
shot0033.jpg
310KB, 1920x1080px
/dpt/-chan, daisuki~

Ask your much beloved programming literate anything (IAMA)

>>61076310
constexpr unsigned int Fib(unsigned int n, 
unsigned int a = 0,
unsigned int b = 1)
{
return n ? Fib(n - 1, a + b, a) : a;
}


>>61076117
Thank you for using an anime image.
>>
>>61077174
Why doesn't constexpr always work? It'd be so nice.
>>
>>61077174
Why are you fat? Don't you want to look better?
Can't you do some sports?
>>
>>61076069 #
https://pastebin.com/wXNXraWB
This is as far as I got. It compiles, but it segfaults and I haven't nosed around long enough to understand why. I'd look into it more but I have plans that are happening soon.
I'll be back later to debug it, unless anyone wants to take a crack while I'm gone.
>>
>>61077174
>"programming" literate
>writes overly condensed code at the expense of others
>c++ with conspexpr AND unsigned int
Dunning Kruger tier
>>
>>61077205
>always work
what do you mean?
>>
is there any point to embedding a C DSL in OCaml?
>>
>>61077242
No.
>>
>>61077174
akari is cut
>>
File: t3_53gynj.jpg (112KB, 720x960px) Image search: [Google]
t3_53gynj.jpg
112KB, 720x960px
>>61077232
Sorry. Please, don't bully.
>Dunning Kruger
meme. https://danluu.com/dunning-kruger/

>>61077211
Not programming related (i run >5km every morning)

>>61077205
What do you mean?
>>
>>61077238
>>61077288
It has stupid requirements like requiring you return non-void types. Can't return objects with non trivial destructor. There's all kinds of shit that would intuitively be assumed to be determined at compile time that C++ doesn't allow. Which severely cripples any enthusiasm for the feature.
>>
File: Capture.png (52KB, 954x582px) Image search: [Google]
Capture.png
52KB, 954x582px
>>61076117
>vi*
>using a shitty, boated, EXPLOITABLE piece of shit editor
lel. How the fuck can a text editor be vulnerable? Notepad never had any fucking exploits for it.
>>
>>61077332
>using notepad
>not using mspaint to edit text files
>>
>>61077332
>affected versions
Wow so it's been going on for such a long time? Disgusting. How do these devs live with themselves knowing they put people's lives at risk like this?
>>
>>61077211
>Why are you fat?
i eat to forget the pain
>Don't you want to look better?
yes but i'm too depressed to want it enough
>Can't you do some sports?
that would require going outside where there are other people and interacting with them
>>
>>61077440
I didn't know Garfield was real.
Or could type.
>>
File: ctr params.png (18KB, 1000x241px) Image search: [Google]
ctr params.png
18KB, 1000x241px
which is more /fa/?
http://www.strawpoll.me/13283083
http://www.strawpoll.me/13283083
http://www.strawpoll.me/13283083
http://www.strawpoll.me/13283083
>>
File: nernums.png (8KB, 558x237px) Image search: [Google]
nernums.png
8KB, 558x237px
post You're formatting method :--)
>>
>>61077331
>return non-void types
what's the point of a constexpr function that returns void?
>Can't return objects with non trivial destructor
I assume you mean constructor here, which you can as long as it's constexpr as well
>>
>>61077536
>all braces are not on the same column
it's shit f a m
>>
>>61077536
Alt + Shift + F

:^)
>>
>>61077536
bait/10
>>
>>61077558
>>all braces are not on the same column
this is not true. two of them are on the same column and another two are on the same column also.
maybe you meant "not all braces are on the same column"
>>
File: pythonic.png (66KB, 597x255px) Image search: [Google]
pythonic.png
66KB, 597x255px
>>61077536
>>
>>61077536
Congrats. You turned C++ into assembly.
>>
>>61077597
>++
excuse me motherfucker

also yes that's my intention, I'm an assembly writer by nature, been doing it forever and trying to learn c now
>>
>>61077604
>>61077597
Been shitposting C/C++. Muscle memory. :D
>>
>>61076117
Hi guys, can someone help me with this exercise in C++?

It's on page 565, chapter 10, 1st programming project of the book "Data Structures and Other Objects using C++", Main-Savich

The text is:
Implement a class for a simple expression tree, where there are two kinds of nodes:
Leaf nodes, wich contain a real number as their entry;
Non-leaf nodes, wich contain either the character '+' or the character * as their entry, and have exactly two children;
Include operatoions for building expression tres.

How i am supposed to handle the different node-type?? What should be the type of my link variable?
>>
File: 50%lessAutism.png (49KB, 597x255px) Image search: [Google]
50%lessAutism.png
49KB, 597x255px
>>61077587
>>
>>61077661
>How i am supposed to handle the different node-type??
Abstract super-type/class

>What should be the type of my link variable?
Your what?
>>
>>61077661
Maybe create a tree node class, then inherit leaf & nonleaf classes from it and use tree node as a link type.
>>
>>61077661
If you're on page 500-something of a C++ book and can't figure this out you should really reconsider programming or actually start caring.
>>
>>61077711
I think he means the variables of the references to the left and right nodes.
>>
>>61077718
>>61077711

Ok i've thought about this, but technically Inheritance and Polimorfism is on chapter 14 so i shouldn't be supposed to use it.

Ok so, using Inheritance, if i want to check the node type, i should typecast to convert the superclass into one of the derived class??? please make a little example of the abstract class
>>
File: 17 - 1 (2).gif (505KB, 1080x1080px) Image search: [Google]
17 - 1 (2).gif
505KB, 1080x1080px
>>61076131
how do one program an shota?
>>
>>61077935
abstract class AbstractNode{

abstract double eval();
}


This is Java Syntax, but C++ is probably similar
>>
>>61077948
I've always wanted to learn to code in ADN.
>>
>>61077996
not him but equivalent c++
class AbstractNode {
public:
virtual double eval() = 0;
};
>>
Is plain javascript ok for a text adventure game or is there a framework thatd help with this

how to choose framework?

im kind of learning as i go through my first web project.
>>
>>61077935
Are there unions in C++? You could declare an union consisting of a char and double for your value field.
>>
>>61077935

There's an obvious (but somewhat inefficient) way to do this without inheritance.

class Node
{
bool isLeaf;
double value;
char operation;
// write some functions
}

You could put both value and operation in a union.
>>
>>61077996
>>61078020
I' retarded but what is that eval? In my book is written that node have 3 variables: data, left link and right link
>>
>>61078160

eval is a virtual function. If you don't know about inheritance, that should mean nothing to you.
>>
>>61078160
It's a function that the implementations of AbstractNode have to override. This way, for an variable n of type AbstractNode, you can call n.eval() without caring which kind of node it is (leaf or binary node)

You now have to add two more classes (one for leaves and one for nodes with an operation and left and right node or links as you call them) and overwrite the eval function in both

>In my book is written that node have 3 variables: data, left link and right link
A node with data (leaf) does not have left and right link, the other one needs an additional variable to store the character

>>61078142
This lacks left and right nodes
>>
>>61078367
Yeah, I just realized.
>>
>>61076117
Julia v0.6 just came out. I just made myself a basic clickbot in Julia with a GTK GUI.

Rate my Julia:
https://pastebin.com/ikxBcQyn
>>
>>61078449
Yulija so cute
Cute
>>
>>61078367
Ohh now i understand
Thanks to everyone guys
>>
How do you do operator precedence in a recursive descent parser for a programming language?
>>
>>61078495
Manually?

With a stack of expressions and operators and a precedence context. And you can make tree each time you're sure.
>>
>>61078495
A = B + B | B - B | var | const
B = (A) | A * A | A / A

You can obviously add more layers if you have more operators with different precedence
>>
>>61078537
Yes manually.
I know how to do the shunting yard algorithm, but I'm not sure how to combine it with recursive descent parser.
>>
>>61078574
Each time you read a lower precedence op you can combine previous tree parts.
>>
>>61078449
mutable struct ClickerBot
gui :: Dict{Symbol,Gtk.GtkWidget}
sem :: Bool
ms :: Int64
maxclicks :: Int64
end

function stopClicking(rob :: ClickerBot)
rob.sem = false
updatefields(rob)
end


At a first glance this looks like a statically typed language. I thought Julia was a dynamic scripting language?
>>
Just finished my lispy in python, 111 lines.
>>
>>61078632
>I wrote a very small program
Thanks for blogging.
>>
>>61078675
>bloated programs
>>
I'm making a game and I'm curious on how to store references.

I have a Player object that has a list of Apple objects.

Each player has a pointer to the game server, where one can retrieve the Apple objects via id in a APPLE_LIST.

However, I also can store the list as simply a list of pointers to the actual Apple objects.

So which is better ?
>>
>>61078703
To clarify on the last part, I meant I can store the list of apples for that specific player as a list of pointers.
>>
>>61078703
What language?
>>
>>61078690
What? No his program probably isn't bloated with that line count in python. It could be but probably not.
>>
>>61078733
Not that girl but
That is clearly completely irrelevant to the problem and is probably something that a stupid language zealot would say.
>>
>>61078733
C++
>>
programing a html parserer with regexxs for NETRUNNER
>>
>>61078603
It is sort of a mix between the two. It is dynamic, but it has strong typing and the compiler will unbox values if it is aware of their type.

The annotations on the function parameters is what type that particular function definition dispatches on. You can have multiple function definitions that dispatch on different types.
>>
#include <stdio.h>
void printTest()
{
return printf("it just works");
};
void main(){
printTest();
}


is it ok to return a printf in a void function?
>>
>>61078805
It depends of the kind of developers you are.
>>
>>61078769
I see. Could you describe generally how the game works, maybe post some code snippets?
>>
>>61078816
i dunno, i try to write everything correctly and respect the conventions
>>
>>61078805
lol
>>
>>61078845
>conventions
Whose conventions?
>>
File: 1493690821458.jpg (8KB, 216x233px) Image search: [Google]
1493690821458.jpg
8KB, 216x233px
>want to get into programming
>anything worth developing requires massive teams with hundreds of millions of dollars in funding
>>
>>61078805
No
I actually think this doesn't even compile
>>
>>61078870
>>>/reddit/
>>
>>61078703
First one

Players should not be in contact with any objects from the server, the only connection should be the interface of functions the player can call
>>
>>61078733
It's in node js.

I'm just using the simple dictionary {} for storing server side Apples, and a [] for storing player Apples
>>
>>61078867
those established in programming books or the linux kernel etc etc
but i'm not an expert, so sometimes i don't know how to proceed and i rather know what professionals do in these situations and adapt to it
>>
Among the most commonly used GUI libraries, is GTK the least bloated?
>>
>>61078495
You get it for 'free' by doing the obvious thing - recurse down into the highest precedence first by structuring the recursive calls as appropriate.
>>
>>61078845
>write everything correctly
>respect *the* conventions
>return an int in a void function
you've failed
>>
>>61078893
The problem/dilemma with that is that whenever I want to call something like eatApple(), you have to first retrieve the Apple object through this.gameServer.APPLE_LIST[id], which is a little tedious?
>>
>>61078900
in js all objects are accessed by reference, your question makes no sense
>>
>>61078932
So basically have multiple types of expr?
Like expr0, expr1, etc.
What's the best naming practices?
>>
>>61078929
Lolno.
The least bloated and also the least comfy is probably Xlib and it's dog shit, but I've seen some people use it successfully.

The best one all around is currently still Qt, even though it's big.
>>
>>61078840
it's kind of like lunar lander
you control an indian
you have to land on a toilet instead of the ground
if you land on the ground, you poo in street
if it's a toilet, you poo in loo
>>
>>61078929
I think that QT is less bloated, but coded by dregs of dregs (ie. dregs of C++ developers).

wx is probably the less bloated.
>>
File: catfinger.jpg (14KB, 540x527px) Image search: [Google]
catfinger.jpg
14KB, 540x527px
Recent grad of an EE and Biometrics dual-major.

I'm kind of a jack of all trades, but master of none. If you're mainly a """hardware""" guy, what fields should one look in, if one seeks to further their programming skills while primarily marketing oneself as an EE?

I have a decent bit of Java experience but only for class projects and shit. Some C as well but generally I wouldn't consider myself a programmer per se; I don't have the general skills at a high enough level to be one.

I'm getting desperate to leave the NEET life :x
>>
>>61078987
learn C
>>
>>61078983
wx is ancient history, I don't even think the wx maintainers are still alive.
>>
>>61078959
i meant should I rather reference the js object directly (player.apple),
or would I retrieve the js object through a quick search through the server's object list with js object's key in order to find the object?

(player.apple = gameServer.APPLE_LIST[player.appleid])
>>
>>61079004
Yep, just access it through the player if it's easier.
>>
>>61078940
You can store copies of the server data client-side, but the clients shouldn't have any references to actual server data
>>
>>61079002
Maybe it still works.
>>
File: fedora vape.jpg (87KB, 900x900px) Image search: [Google]
fedora vape.jpg
87KB, 900x900px
>>61078987
Forgot to add I'd really like to get into the IoT space, or any kind of controls-oriented career. I bought a steam controller recently and despite being a meme, I really like the way you can customize it in a million ways to provide different methods to input the same key sequence or whatever. I'd love to extend that same type of concept to IoT sHIT
>>
>>61078987
C is definitely what you want to know, anything low level is C.
>>
>>61076129
This is mine. It works pretty well.
SOURCEDIR=src
INSTALLDIR=obj
INCLUDESDIR=includes

CPP_FILES=$(wildcard $(SOURCEDIR)/*.cpp)
OBJ_FILES=$(addprefix $(INSTALLDIR)/,$(notdir $(CPP_FILES:.cpp=.o)))

CC_FLAGS=-std=c++11 -I $(INCLUDESDIR)/ -O2
CC_FLAGS+=-Wall

main: $(OBJ_FILES)
g++ $(CC_FLAGS) -o $@ $^

obj/%.o: src/%.cpp
g++ $(CC_FLAGS) -c -o $@ $<

clean:
rm $(wildcard $(INSTALLDIR)/*.o)
>>
>>61078845
then no it is not ok
>>
Sould I learn C3/.NEET or Java as my first programming language?

1st year of CS, no programming classes yet - next semester I should have a class in C#. I've read some articles, checked local job offers

C#
>I'll have this in class
>"java done right"
>most things just work out of the box
>easier to learn

Java
>more job offers than C#
>teaches problem solving better than C#
>better support and community

what does /g/ think?
>>
>>61079564

C# is not easier to learn than Java since there is simply more stuff to learn.
>>
>>61079564
Both give you a ton of jobs, don't worry. C# has slightly fewer developers applying to the same job.

Learning the other once you've learned one will be very easy, so you're not locking yourself in.
>>
I just had one of those "holy fuck that's how it works how could I have been so fucking blind" moments. I love that feeling, but I just wish it could've come without needing to struggle across that finish line first.
>>
>>61079719
This is how you learn best senpai.
>>
>>61079564
>"java done right"
nice meme
>>
What's a nice visual library for java and/or python?
A-Asking for a friend
>>
Openstack with OVS+DPDK.
>>
>>61076117
What fucking font makes your #s look superscripted? Yucky.
>>
File: 1449083854825.jpg (115KB, 1280x720px) Image search: [Google]
1449083854825.jpg
115KB, 1280x720px
what can i do to improve as a 4th year cs major
basically i have a bunch of free time outside of my internship, do i try to get ahead in my classes next semester, learn a new skill or just study work related stuff

at work i'm doing cybersecurity stuff and during the semester i was doing this thing with machine learning. i've always wanted to learn how to build websites but i don't see it going anywhere if i can't apply it to something. so yeah any igeas :ddDDDD
>>
>>61080106
study data structures and algorithms
>>
>>61076117
What language is that?
>>
>>61080118
lisp
>>
Lets say i wanted to learn by studying some open source project. How do i even begin to understand the source code when i have no idea whats what, no matter how small a project is, it all seems like a clusterfuck and i have no idea where to start
>>
>>61080154
> How do i even begin to understand the source code when i have no idea whats what
So learn a language before you frikkin retard
>>
>>61080154
make some midsize to large projects of your own first
>>
>>61080154
Try to modify random things or add random print. And you must see your modifications when running the new compiled binary.
>>
>>61080118
HolyC
>>
Has /dpt/ finally turned me gay? I just had a dream about having sex with a trap.
>>
>>61080318
Nobody turned you gay. You're just gay anon (or maybe bi). Buy a dildo and stick in your ass when fapping. You'll enjoy it.
>>
>>61080318
Ignore >>61080330
>>
>>61078805
Yes, it'll work technically but the compiler should throw a warning. Don't do it.
>>
>>61080318
I just erped about tuning into a trap
I'm mad because the other guy ran off, probably already fapped, the cunt
>>
Trying to learn inline assembly in gcc (Eww, AT&T syntax is shite)

Am I doing this right?
    asm(  "cpuid;"
"mov %%eax, %0;"
"mov %%ebx, %1;"
"mov %%ecx, %2;"
"mov %%edx, %3;"

: "=r"(ret.eax)
, "=r"(ret.ebx)
, "=r"(ret.ecx)
, "=r"(ret.edx)
: "%eax"(leaf)
: "%eax","%ebx","%ecx","%edx"
);
>>
File: 1477871042233.png (958KB, 900x1138px) Image search: [Google]
1477871042233.png
958KB, 900x1138px
>>61080390
W-want to (e)rp with me anon? Non-lewd rps are fine too, I just want a friend ;_;
>>
>>61080671
you expect me to erp with some sissy anime lover?
>>
>>61076310
Am I supposed to implement a big ass huge integer library here?

unsigned long long can't hold fib(100).

unsigned long long fib_r(unsigned long long *a, unsigned int n)
{
if(n < 2) return n;
if(a[n] > 0) return a[n];
unsigned long long t = fib_r(a, n - 1) + fib_r(a, n - 2);
a[n] = t;
return t;
}

unsigned long long fib(unsigned int n)
{
unsigned long long a[n + 1] = {0};
return fib_r(a, n);
}
>>
File: 1468602906455.png (916KB, 900x1242px) Image search: [Google]
1468602906455.png
916KB, 900x1242px
>>61080851
B-but, you just erped about tuning into a trap
>>
>>61080874
Even that's less gay than watching anime
>>
>>61079564
>teaches problem solving better than C#
says who?
>>
>>61080914
;_;
>>
>>61080964
C# has more built in meme crap which discourages you from implementing algorithms yourself
>>
>>61080997
Such as?
>>
>>61080997
linq
>>
>>61080874
What is happening here?
>>
>>61080106
Do some bug bounties to make cash and make the internet safer!
>>
>>61080997
Alternatively, this could be read as
>C# doesn't make you re-implement trivial shit because it's already built-in
>>
>>61079564
>teaches problem solving better than C#
what

if by this you mean you have to do more work to accomplish the same task in Java, then sure

You can always go to http://sourceof.net/ if you want to see how they implemented any particular algorithm.
>>
>>61080865
Just use long arithmetic
>>
>>61077031
The last function call is TCO.
So no.
>>
>>61080865
open Num;;

let fib n =
let rec loop a b = function
| 0 -> b
| n -> loop b (a +/ b) (pred n) in
loop (Int 0) (Int 1) n
;;

let () =
let n =
match Array.length Sys.argv with
| 1 -> 100
| _ -> int_of_string Sys.argv.(1) in
print_endline (string_of_num (fib n))
;;


and ./fib 100
573147844013817084101
>>
>>61081237
what a pretty looking language
is that ocaml?
>>
>>61081142
So implement an array of chars or ints and do custom arithmetic on them?

>>61081237
fib(100) = 354224848179261915075
>>
>>61081272
yes
>>
>>61081237
>;;
You don't need these ;_;
>>
>>61080671
skype?
>>
>>61081328
>skype
It's hell but that's where all my ERP partners are. Can't convince them to leave.
>>
>>61081361
ok, skype?
>>
>>61081084
magic
>>
File: 1458993598815.jpg (37KB, 348x342px) Image search: [Google]
1458993598815.jpg
37KB, 348x342px
>>61076117
What is the best Lisp for making small games? Is clojure any good?
>>
>>61076310
(define fib
(lambda (n)
(if (< n 2)
1
(+ (fib (- n 1)) (fib (- n 2))))))
>>
>>61081442

Surely that doesn't avoid exponential time
>>
any cute girl(male) programmers in this thread?
>>
>>61081409
Can you elaborate?

>>61081442
monads are a waste of time
>>
>>61081276
>fib(100) = 354224848179261915075
That's what I call fib 99. But you can define fib as you want.

>>61081307
I know, but I'm used to them. And I work with a guy who use them and does not want to change.
>>
>>61081426
ECL
>>
>>61081496
>monads are a waste of time
how come


>>61081493
nope, only girl(females) here
>>
>>61081442
>>61081496
>>61081516
>muh "moan ads"
>muh "lamb duhs"
>>
>>61081516
>girl(females)
>multiple females identifying as one girl
this thread suddenly became a lot scarier
>>
>>61081516
>nope, only girl(females) here
:(
>>
>>61081543
she she and she are pretty good at programming though
>>
>>61081543
Stop the schizophobia, you ableist fuck!
>>
>muh
>>>/v/
>>
Is functional programming the final destination of computer science?
>>
>>61081876
Functional programming was tried and it failed. Now it's just a bunch of pet projects for academics to wank over while the rest of us get work done.
>>
>>61081516
>how come
Remember that one time when knowledge of monad memes earned you money?

Yeah?

Well, it wasn't as much money as could have been had by knowledge of random javabeans and NuGet packages.
>>
>>61081876
FP is a tool to be included in useful imperative languages.
>>
>>61081902
>money
I'm not a materialist
>>
>>61081902
Oooh, sick wageslave burn!
>>
>>61081921
>>61081924
>money isn't the key to essentially every human desire

lol
>>
>>61081613
pretty sure that's when one female identifies as multiple girls
>>
>>61081896
>Functional programming was tried and it failed.
REEEEEEEminder that true functional programming has never been tried
>>
>>61081957
Yes, it isn't.
>>
great, i spent the whole afternoon trying to figure out what to learn and i ended up doing nothing. now i have to do laundry. peace
>>
>>61081902
>memes
>>>/v/
>>
>>61081957
It is, but only for kikes such as yourself.
>>
>>61081896
>Functional programming was tried and it failed
>it failed
[citation needed]
>>
Currently NEET. Trying to work on a portfolio of sorts for when I'm healthy again. Is it better to work on a 'real' project (something big), or to do shit loads of smaller Project Euler type challenges? 15 year old memers need not reply
>>
I have to verify if a string belongs in a set of string which is static (doesn't change during program execution) and return which string it was.
Language is C.
Hash table?
>>
>>61082240
how large is the set?
>>
10 years experienced programmer, out of work for 6 months now. I'm regressing, save me.
>>
>>61082238
>memers
>>>/v/
>>
>>61082070
>kikes
>>>/pol/
>>
>>61082299
>>>>/pol/
>>>/b/
>>
>>61082280
Not so large, basically it's set of keywords of C.
>>
>>61082238
A real project is better for practicing at the most important parts of programming, better for your self esteem, better for showing off. Requires more commitment though.

Project Eular might be battery for preparing for a more algorithmically intensive job.
>>
>>61082240
String comparisons stop at the first non matching char, just iterate through. Unless you have millions to check.
>>
>>61082317
well it still depends how often you're going to do the check, but if it's intermittent just a linear search will be fine
>>
>>61082289
Get a job in a garage truck. Way more fun.
>>
>>61081876
The final destination of CS is for computer scientists to express the math in any form and have an AI implement it.

But at that point I expect for most of the interesting CS stuff to be exhausted. We'd be needing more real science.
>>
>>61082289
>out of work
A programmer is never out of work. If your dedication to programming is so weak that you stop whenever nobody is paying you to do it you're not a real programmer.
>>
>>61082361
No, it's frequent because it is a lexer.
>>
>>61076117
Can someone gib sauce of happyfrog file
>>
>>61082391
Running out of money. Fucking around with go in the meanwhile.
>>
>>61082328
makes sense, thanks. commitment isn't really the problem but energy is. i think i'll just slowly increment project size.

Anyone who's interviewed recently, did you have a github with all your smaller stuff on it available, and would an employer even care?
>>
Does anyone else get worried when Google captcha asks you to identify 'bicycle', 'helicopter', 'civilian', 'Su-47', 'religious fanatic' etc?
I'm a pacifist and I'm not too comfortable with this anymore.
>>
>>61082289
>>61082406
Learn C#

Have a job by Thursday.

or java if you have no self-respect
>>
>>61082395
You just got yourself a new programming project!
>>
>>61082426
Not programming.

>>>/pol/
>>
>>61082427
No self respect is required for both of those languages. Read MSDN (also requires no self-respect, but I've been told it's in there).
>>
>>61082433
But it's clearly about training a neural network anon. What obligation does the test data have towards the victims of the NN? Same goes for the old training data like identifying cars and signs. What if you tick one of them wrong? You could be guilty of causing an accident.
>>
>>61082426
anybody who's anyone uses legacy captcha
>>
>>61082433
>Not programming.
>>>>/pol/
Not programming.

>>>/b/
>>
>>61082428
>programming
ASCII art with some color coding isn't programming

>>>/out/
>>
>>61082393
but like you said, the search space is really small. presort into a BST if you find a linear search is too slow
>>
>>61082486
>ASCII art with some color coding isn't programming
Not programming.
>>>/b/
>>
Anon please fix your infinite recursion.
>>
>>61082504
>shitposting in /dpt/
Not programming
>>>/out/
>>
>>61082522
>Not programming
>>>>/out/
Not programming.
>>>/b/
>>
NEW THREAD!!!

>>61082558
>>61082558
>>61082558
>>
From a pure job security, job availability, and long-term salary point of view, would it be better to choose information security or software development in my career?

I realize that both of these are massive fields with many subfields to choose from, but I would like some general guidance. I am finishing up a CS degree from a good university, and have one internship plus a few side projects under my belt.

I am interested in both software dev work and software security stuff, and have to pick a career path. If one is equally interested in both, which do you guys feel is the best route to take? Which path won't be infested with h1b's?
>>
File: 1482774812130.jpg (136KB, 546x700px) Image search: [Google]
1482774812130.jpg
136KB, 546x700px
>>61082306
>>
>>61082498
If I make an hash of all string in set and the sort the array of hashes and then use binary search, would it be good?
>>
>>61082792
If you've made a hash of a string you can use it to index a hash map. Removing the need for sorting.
But you probably gain a little from binary searching the hash array.
I say that for the set of keywords in C you should just use a trie
https://en.m.wikipedia.org/wiki/Trie
You will very quickly reach the end result. And the entire thing will probably be hot if allocated well.

But really doing algorithmic optimization for this case is already overkill. Just write whatever you find is simplest and improve it later if you have performance issues.
>>
C++17 > *
https://pastebin.com/yhn9jznb
Thread posts: 313
Thread images: 24


[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.