[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: 326
Thread images: 44

File: 1502511738145.png (111KB, 600x800px) Image search: [Google]
1502511738145.png
111KB, 600x800px
What are you working on, /g/?

Previous thread: >>61861536
>>
>>61868196

::operator new
usually just calls malloc under the hood, but that's how the sepples people roll if you want uninitialized memory.
>>
how do i push the length onto the stack and then pop it back into rdx without it segfaulting? i know that's the cause. it's getting a much bigger number out than i put in
section .data
HW: db "Hello, world",10
HWLen equ $-HW

section .text

Print:
pop rdx

push rcx ; save registers
push rbx
push rax

mov rax,4 ; sys_write
mov rbx,1 ; stdout
mov rcx,OutputBuffer ; define buffer location
int 80h ; system call

pop rax ; restore registers
pop rbx
pop rcx
ret

global _start
_start:
nop
mov rax, HWLen
Dec:
mov bl, [HW+rax-1]
mov byte [OutputBuffer+rax-1], bl
dec rax
jnz Dec
mov rdx,HWLen
push rdx
call Print
jmp Quit

Quit:
mov rax,1 ; sys_exit
mov rbx,0 ; exit code 0
int 80h ; system call

section .bss
OBMaxLen equ 256
OutputBuffer: resb OBMaxLen
>>
>>61868388
Why though?
I was going to answer that it would simplify resource management because you wouldn't accidentally delete a malloc'd block, but then I remembered that you already have delete and delete[].
>>
File: too_much_internet.jpg (465KB, 1469x1536px) Image search: [Google]
too_much_internet.jpg
465KB, 1469x1536px
>>61868494
>call Print
>jmp Quit
>Quit:
>>
>>61868503
Heck I know, this is one of the parts of C++ that wasn't well thought out.
>>
>>61868529
why not modularize your assembly? just because it functions the same as if it was all one blob of code doesn't mean it should be
>>
>>61868554
Maybe it's better style to just never new[] and use vectors or something. Then you can count on delete always working.
>>
If you do not understand why garbage collection is the superior memory management system you should leave this thread right now and come back when you are more educated.
>>
>>61868576
the guy is literally jumping to the next instruction, stalling the processor for nothing. only a fool would accept this.
>>
>>61868582
Yeah, the "modern" way of doing things is to use containers, and smart pointers.
>>
>>61868612

> garbage collection is the superior memory management system

2/10
>>
>>61868635
Unironically leave now.
>>
>>61868612
Which is more valuable, programmer time or machine time?
>>
Pointer bump allocation s the superior memory management system.
>>
>>61868624
i'm 'the guy'. i'm not writing a compiler, i'm writing hello world learning assembly. nice to know what you do and don't accept in hello world programs, but do you know the solution to the question?
>>
>>61868665
Both use less time when using a well-chosen garbage collector.
>>
>>61868690
proofs?
>>
File: python.png (82KB, 720x1051px) Image search: [Google]
python.png
82KB, 720x1051px
Python performs pretty well tbqh
>>
>>61868690
that's not true though
>>
>>61868710
>>61868715
It's been known for decades GCing is faster for machine time. The current research focuses on lowering the memory overhead.
https://www.researchgate.net/publication/222464257_Garbage_collection_can_be_faster_than_stack_allocation
>>
>>61868712
damn who would have thought?
>>
>>61868690
untrue and a gc need 5x more memory
>>
File: 1490037163626.jpg (208KB, 1920x1080px) Image search: [Google]
1490037163626.jpg
208KB, 1920x1080px
>>61868712
In such useful applications like calculating spectral norm and generating the Mandelbrot set.
>>
>>61868682
>but do you know the solution to the question?
i don't do 32 bits assembly.
>>
>>61868787
spoken like a true C Linux kernel hax0r master
>>
What should I learn as my first programming language?

Should I even bother?
>>
>>61868758
>An old and simple algorithm for garbage collection gives very good results when the physical memory is much larger than the number of reachable cells.
>In fact, the overhead associated with allocating and collecting cells from the heap can be reduced to less than one instruction per cell by increasing the size of physical memory.

>Garbage collection is faster when you never need to collect garbage.
>>
>>61868807
Assembly.
>>
>>61868807
No

business / economics is where it's at
>>
>>61868811
You might want to read the paper and citations before giving your uninformed opinion.
>>
>>61868807
Pick fucking anything. Seriously, it doesn't matter. Once you learn one it's easy to learn another.
>>
>>61868823
you're in /dpt/, the realm of expert FizzBuzzers, don't expect too much.
>>
>>61868388
I believe that C++ rolls its own seperate version of malloc.
But yes, for some reason C++ cares a lot about ensuring that memory is initialized, but it doesn't really give a fuck if a pointer is valid or not or if a const reference is really constant.
>>
>>61868804
i don't like c at all but it is true i have masterized both C and the linux kernel (not entirely but the core modules)
>>
>>61868804
"""
we show that the runtime performance
of the best-performing garbage collector is competitive with explicit
memory management when given enough memory. In particular,
when garbage collection has five times as much memory
as required, its runtime performance matches or slightly exceeds
that of explicit memory management. However, garbage collection’s
performance degrades substantially when it must use smaller
heaps. With three times as much memory, it runs 17% slower on
average, and with twice as much memory, it runs 70% slower. Garbage
collection also is more susceptible to paging when physical
memory is scarce. In such conditions, all of the garbage collectors
we examine here suffer order-of-magnitude performance penalties
relative to explicit memory management
"""

https://people.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf
>>
File: 1466405012754.jpg (58KB, 720x405px) Image search: [Google]
1466405012754.jpg
58KB, 720x405px
>>61868494
Don't know the answer but it might be a good idea to write the same program in C and decompile with gdb, see how C does it?
>>
>>61868801
just realized it's because calling a routine pushes the address of where you left onto the stack, so that's what i'm accessing. thanks /dpt/ couldn't have done it without you
>>
>>61868807
>Should I even bother?
https://www.youtube.com/watch?v=DBXZWB_dNsw
>>
>>61868905
it's this
>>61868918
i appreciate the response though. When i disassemble C programs i see a lot of random stuff that throws me off, though i'm sure it all means something
>>
>>61868893
>In particular, when garbage collection has five times as much memory as required, its runtime performance matches or slightly exceeds that of explicit memory management.
It's a good thing memory capacity is cheap these days.
>>
>>61868494
It's because call push the retur n address in the stack. So you popping the return address. Why not just pass the value by register?
>>
>>61868814
unironically this

some people say that programming is bookkeeping basically
>>
>>61868996
i was trying to make it so it'd require as few registers occupied as possible. i know i'd be able to do a double pop and push but that seems excessive. in literally the next paragraph of the book i'm reading it had an example of exactly what i'm doing and said why it doesn't work
>>
>>61869043
Passing by registers is the way of passing arguments.
>>
>>61868612
Just had to order new servers at work because 8 gigs of ram couldn't accommodate more than four rest services written in java. This is the power of garbage collection.
>>
>>61869058
how would you pass more than a handful of arguments?
>>
How did the meme start that any kind of programming changes are too difficult to bother? Especially related to video games.
>>
>https://en.wikipedia.org/wiki/Bubble_sort
>Although the algorithm is simple, it is too slow and impractical for most problems even when compared to insertion sort.
Why is bubble sort slower than insertion sort when they both have O(n^2) and Ω(n)?
>>
>>61869072
Do you know how many registers you have on x86_64?
>>
File: qa_bored.jpg (54KB, 1200x675px) Image search: [Google]
qa_bored.jpg
54KB, 1200x675px
>need to make an app android/iOS
>"just do whatever you want xDD"

anyone got ideas?
>>
>>61869093
Make an app that can detect excessive levels of radiation.
>>
>>61869082
probably cache, cache is magic that makes everything slow or fast
>>
>>61869093
make an app to generate app ideas
>>
Every variables and objects in function get destroyed after return, right?
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
The only 3 languages that non-brainlets need to know:
>C
>Fortran
>Mathematica
>>
>>61869123
right (in c++)
>>
File: abcd.png (390KB, 2000x2000px) Image search: [Google]
abcd.png
390KB, 2000x2000px
>>61868339
We are making a web browser! >>61834915

Join the devs at the IRC channel.
>>
>I need to make lists of languages to learn because I'm a brainlet and can't pick up new things quickly
>>
>>61869136
What factor do you think that causes memory leak in c++ (especially in embedded system such as ESP8266)?
>>
>>61869167
code monkeys
>>
>>61869167
memory allocated with new or malloc does not get released automatically, so trace those pointers.
>>
>>61869178
>>61869173
Thanks
>>
>>61868339

You learn those, I'll learn C and asm to code those languages
>>
>>61869093
Make an app that counts how many times you fart
>>
Are there any good primers on doing database stuff+designing schemas? I have no experience with databases but the project I'm working on is going to need one, and I have no idea where to start.
>>
i'm making a program that counts the occurence of each word in this thread
but i'm getting this keys in my dict
{ 
....
"/g/?Previous": 1,
"thread:": 1,
">>61861536": 1,
">>61868196::operator": 1,
"usually": 1,
"calls": 1,
"under": 1,
"hood,": 1,
...
}
>>
>>61869349
SQL I assume?
>>
>>61869405
Yes, but I need foundations in database design in general as well, not just how SQL works.
>>
>>61869349
Database normalization
>>
>>61869417
Just make sure you normalize your tables and you'll be fine.
>>
File: 1500160693901.jpg (44KB, 500x500px) Image search: [Google]
1500160693901.jpg
44KB, 500x500px
>/dpt/'s recommended programming languages : turning complete unemployment

every time
>>
File: x1Rdn.png (12KB, 442x337px) Image search: [Google]
x1Rdn.png
12KB, 442x337px
>>61868918
>just realized it's because calling a routine pushes the address of where you left onto the stack
Read about calling conventions. They're essential when reading compiler generated code.
>>
How come software just never fucking works? Any time I try to do anything with a computer, I follow the installation directions, and immediately run into like 50 problems. Why do you guys make such awful software?
>>
>>61869082
Right on the page:
>Bubble sort also interacts poorly with modern CPU hardware. It produces at least twice as many writes as insertion sort, twice as many cache misses, and asymptotically more branch mispredictions.[citation needed] Experiments by Astrachan sorting strings in Java show bubble sort to be roughly one-fifth as fast as an insertion sort and 70% as fast as a selection sort.

Also, bubble sort always does much more comparisons than insertion sort.
>>
>>61869699
To annoy you. Specifically you. Everyone else has the special code to make things work. But you don't.
>>
>>61869737
It honestly does seem like I'm the one with special powers, to instantly fuck up any piece of software. I should be in QA not development.
>>
>>61869699
we don't make software here
>>
>>61869761
Please don't. We're drowning in legacy tickets as it is and the new project is already falling down in flames (though that's the hardware guys' fault).
>>
>>61868339
>shen
>no foss implementation
no thanks
>>
>>61869805
what a joke
>>
Threadly reminder that all dyanmic languages should have died long ago.
>>
>>61869920
except lisps
>>
>>61869939
Especially lisps.
>>
>>61869920
why?
>>
>>61870018
Because Python and JS exist
>>
>>61870018
Why? It's a great hand hold. Especially when refactoring code.
>>
>>61869939
Lisps are dead anyway.
>>
>>61870100
Wrong.

A strong, static type system is a great hand hold when refactoring code.
>>
>>61870063
Statically typed languages should have died long ago because COBOL exists?
>>
>>61868339
what if you need a job?
>>
>>61869920
Only the dynamically typed languages which inherit from Self (most of them) must be eliminated. Lisp is good, Smalltalk is alright as well.
>>
>>61869795
Let me give you an example.

Why the fuck does vmware not work out of the box with a basic fucking ubuntu guest distro? I try to install vmware tools and I get this error:

>The path "" is not a valid path to the 4.10.0-28-generic kernel headers. Would you like to change it?

I google the problem and get this: https://askubuntu.com/questions/40979/what-is-the-path-to-the-kernel-headers-so-i-can-install-vmware

I try to install those packages like this: $ sudo apt-get install build-essential linux-headers-$(uname -r)

>linux-headers-... is already the newest version.

Great... Now what? Why does that apparently solve the issue for everyone but me?
>>
Wrote ugly tests for the parser.

Now that I know how to write macros in Racket effectively, they've become a very useful tool. Most of my macros have either been "definer" macros, e.g. a macro for defining AST structs, and a macro for defining lexer keywords. Also, macros for testing, for instance pic related uses a somewhat complex macro that makes it easy to represent fake source locations and automatically constructs the input for the parser, runs it, then checks against the expected AST output.

For those who think Racket macros are trash because "muh hygiene": The $N-src identifiers are bound automatically and un-hygienically. What's nice about Racket macros is that they are hygienic by default, but allow you to fairly easy inject an unhygienic identifier into an appropriate context
>>
What's wrong here?

private class addButtonListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
url = "jdbc:mysql://localhost:3306/workapp";
username = "root";
password = "password";

System.out.println("Connecting database...");

try{

Connection conn = DriverManager.getConnection(url, username, password);
Calendar calendar = Calendar.getInstance();
java.sql.Date startDate = new java.sql.Date(calendar.getTime().getTime());
String query = " insert into running (date, time, distance)"
+ " values (?, ?, ?)";

PreparedStatement preparedStmt;

preparedStmt = conn.prepareStatement(query);
preparedStmt.setDate(1, startDate);
preparedStmt.setInt (2, Integer.parseInt(timeT.getText()));
preparedStmt.setInt (3,Integer.parseInt(distanceT.getText()));
preparedStmt.execute();

} catch (SQLException e1) {
e1.printStackTrace();
}

}
}


Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:592)
at java.lang.Integer.parseInt(Integer.java:615)
>>
>>61870178
Why do you use 68 spaces for indentation my dude?
>>
>>61870227
>preparedStmt.setInt (2, Integer.parseInt(timeT.getText()));
>preparedStmt.setInt (3,Integer.parseInt(distanceT.getText()));

One of these.
>>
>>61870227
One of the strings you're parsing with parseInt is empty.

>>61870235
Linus says 4 is too little, I think Linus is a little bitch and that 8 is too little. So I use 68. Like a real programmer
>>
>>61870227
>calendar.getTime().getTime()
>>
>>61870260
But 68 is not a power of two multiple of 4, so it makes it less efficient for the compiler to process.
>>
>>61870297
Yes but I like to show the compiler that I am smarter than it, so I intentionally give it difficult tasks that are easy for me, an intelligent human.
>>
>>61870178
tdd?
>>
>>61870256
>>61870260
The textfields are set as public and there is a value in them, why are they null?
>>
>>61870420
Isn't test driven development when you write tests before the code? cause I wrote the code before the tests
>>
>>61870434
Null? Please re-read the exception. It's not a null-pointer exception.
>>
File: 2017-07-26-114742_1679x943_scrot.png (806KB, 1679x943px) Image search: [Google]
2017-07-26-114742_1679x943_scrot.png
806KB, 1679x943px
>>61870458
>Isn't test driven development when you write tests before the code?
yes

>>61870458
>cause I wrote the code before the tests
pic
>>
File: fred.jpg (19KB, 508x675px) Image search: [Google]
fred.jpg
19KB, 508x675px
>>61870512
I'm not doing TDD tho, I'm just writing tests to make sure my shit works
>>
What the fuck is up with Google's super inconsistent naming, this is terrible
>>
File: holo sad.png (303KB, 800x485px) Image search: [Google]
holo sad.png
303KB, 800x485px
    
int i;
int j;
int tmp;

i = 0;
do {
j = 0;

while (i < n - 1) {
if (values[i] > values[i + 1]) {
tmp = values[i];
values[i] = values[i + 1];
values[i + 1] = tmp;
++j;
}
++i;
}
} while (j != 0);


Why doesn't it work
>>
>>61870766
cute anime
what is the problem
>>
>>61870766
where did you declare 'n'
>>
>>61870771
I'm doing this: http://docs.cs50.net/problems/find/less/find.html
I've got the search algorithm, if I input a sorted list of values it finds the value.
If it gets stuck somewhere.

./find 2
with the list 1, 2, 3, 4, 5, 6 finds 2
but with 5, 2, 1, 3, 6, 4 it gets stuck

>>61870811
void sort(int values[], int n)
>>
File: Untitled.png (7KB, 347x434px) Image search: [Google]
Untitled.png
7KB, 347x434px
>>61870823
Here's a screenshot
>>
how many projeets you on anon?
>>
Can anyone post that roll-for-a-project image?

I need ideas.
>>
>>61868682
People like you are insufferable, they're offering you valid criticism with an explanation, you have 2 acceptable options, ignore it if you already know that or take it into consideration, instead you choose to respond with a snarky attitude. The fact that you're a beginning should force you to be more receptive to criticism, not more repulsive, they're explaining why what you're doing is bad and you have the opportunity to not form such a bad habit from the beginning. People like you are the reason others are reluctant to offer advice, what's the point in trying to help when the other person is just going to be an asshole in turn. I'm sure most people don't expect appreciation or praise but I bet almost nobody expects to get an attitude, at least they shouldn't but then there's people like you.
>>
>>61870863
two
>>
>>61870938
http://better-dpt-roll.github.io/
>>
>>61870951
you are like a little baby
>>
On a scale from 1 to impossible, how hard would it be for an individual to write their own browser from scratch (parser + layout engine + rendering)?
>>
>>61871110
2017
>>
>>61871110
why?
>>
>>61871170
It seems like a very interesting technical challenge (that's also extremely massive and perhaps insurmountable)
>>
>>61870852
It looks like you're not resetting i in the outer loop
>>
>>61871106
watch THIS

*whips out yugioh deck*
>>
File: Unioh.png (343KB, 439x720px) Image search: [Google]
Unioh.png
343KB, 439x720px
>>61871210
>>
>>61869065
>can't fit more than 8 GB in his servers
Seems like the problem lies somewhere else.
>>
>>61871110
Start by designing your own CPU architecture, otherwise you're not doing it from scratch.
On a more serious note, I'd say it would take 2 years to have something minimally usable (with no add ons such as Javascript). Much more if you want to be standard compliant.
>>
>>61871110
Standards complient, we are talking about millions of lines of code, webbrowsers today are massive, no single man can do this unless you want to book the next 20 years
>>
>>61870178
have you ever used the racket gui framework?
>>
>>61868612
If you can't control your own garbage how do you expect a language to do the same? Expecting a language to do your dirty work is bad
>>
>>61871376
yeah, they needs stuff coming from many different fields:

a renderer to draw the web pages
an image loader for reading the jpeg, gif, png, ...
a sound player (mp3, ogg, ...)
a video player (webm, mp4, ...)
an implementation of javascript
webgl
drm
websockets
...
>>
I'm slowly trying to get into C++ by doing some simple dlls for my C# programs using pinvoke, but I'm not sure what's the extent of data types that can be exchanged though the interop.

For example, this simple dll to rename a file.
C++ code:

.h
#pragma once

extern "C"
{
__declspec(dllexport) int DoRename();
}


.cpp
#include <iostream>
#include "Rename.h"

int DoRename()
{
int result = rename("0.jpg", "test.jpg");
return result;
}


C# code:
void CallDll ()
{
int n = DoRename();
MessageBox.Show(n.ToString());
}

[DllImport("Rename_DLL.dll")]
static extern int DoRename();



This works fine because it just returns an integer and takes no parameters, but what if I wanted to pass a C# string as an argument to my dll (the file path for example), would I need to parse it in my C++ code, and what would be the best way to do that? Can I pass more complex stuff to my dll or just primitive data types?
>>
Any ideas for some project to get my feet wet in c++? currently going over bjarne's book.
>>
>>61868339
stop using this pic as op pls
anime grills with programming books would be better
>>
>>61871384
Yes a little bit, do you need help with something?
>>
>>61871110
https://github.com/chrisdone/wish>>61871146
>>
>>61868339
I'm learning about cool Haskell stuff like ConstraintKinds. Is it wrong if after 30 minutes of listening about type classes I feel like having a wank?
>>
>>61871582
I think the best way is to make your DLL in C++/CLI's mixed mode. That way you can easily marshal (that's what converting between managed and native data is called) between C++ and C#.
>>
>>61868612
this, lisp garbage collector is so advanced and when one knows what to do, one can reduce consing and gc time
lisp is god tier desu
>>
>>61871694
how to handle buttons? should the button's callback push an event and then the main loop handles that event (like changing the program state) or the button's callback should change the program state?
>>
>>61871740
no one uses lisp for jobs though
>>
>>61871733
all the extensions are like that
>>
>>61868807
Lisp pls.
Read SICP (Structure and Interpretation of Computer Programs)
Buy the book, read it everyday, will make you feel good
>>
>>61870688
No wonder they are trying to make Go as braindead as possible.
>>
>>61871755
You mean making you feel like having a wank? Yeah, When I was reading about type families and functional dependencies I also got hard.
>>
>>61871776
>trying to make Go as braindead as possible.
explain
>>
>>61870167
Isn't smalltalk python tier?
>>
>>61871796
wat
>>
>>61871210
>>>/reddit/
>>
>>61871786
They have come out and said they are making Go as simple as possible, because they want their interns to use it. That's why it's lacking any kind of advanced features.
>>
>>61871752
>jobs
where do you think you are
there are java lisps thpugh
>>
>>61871625
write a key-value database library
>1. simple class for getting or setting keys. have it map strings to strings and write the hash table yourself.
>2. save and load database as a file
>3. split the entries across multiple files for web scale
>4. automatically store or cache data when in-memory storage is too large. stress test this with huge 9gb data sets
>5. paremetric, so you can store values other than strings (homogeneous data)
>6. instead of just other files, store data on other computers and communicate across the network (this is a DHT)
>7. use this to store fizzbuzz from 1-1 billion
>>
Which one of these is better from a design POV or are they both pretty much the same? A controller will only ever live as long as level.

Controller.cs
class Controller {
public void Update(Level level);
}

Level.cs:
foreach (var character in Characters) {
character.Controller.Update(this);
}

Controller.cs:
class Controller {
private Level level;

public void Update();
}

Level.cs:
foreach (var character in Characters) {
character.Controller.Update();
}
>>
>>61871752
what do you know about software development? what have you done?
>>
>>61871840
what do YOU know about software development? what have YOU done?
>>
>>61871804
I heard here that smalltalk is a python tier, and therefore I shouldn't use it.
>>
>>61871726
Based on the project description, he just glued together a pre-made html parser with sdl
>>
What are some cool irc channels to lurk
>>
>>61871854
enough to know that clojure is not rare in the bay.
>>
>>61871830
Why not merge the controller into the level?
>>
>>61871824
that sounds fun, thanks.
>>
>>61871854
answer the question, sir.
>>
>>61871869
>in the bay.
there's more world out there than fucking sf

>>61871878
never had a job. still a student.

i have seen thousands of job posts. no one asks for lisp
>>
>>61871869
clojure is crap
>>
>>61871871
I should have marked controller as abstract, there will be at least PlayerController and AIController subclasses.
>>
>>61871864
#gamedev
#reddit-gamedev
#python
#bash
>>
>>61871903
yeah, but if you finess, you can find one
>>
>>61871913
kys
>>
>>61871913
Oh, than I would opt for the first.
>>
>>61871903
>>61871911
https://clojure.org/community/success_stories
https://clojure.org/community/companies
https://angel.co/clojure/jobs
https://stackoverflow.com/jobs/developer-jobs-using-clojure
https://jobs.braveclojure.com/
>>
>>61871747
Probably push to the event loop so that you can properly seperate concerns (view vs controller kind of thing)
>>
>>61871973
PHP has lots of success stories, but that doesn't make it good.
>>
>>61871973
woah 5 links to jobpostings to link at, damn i guess it's time to learn clojure
>>
>>61871830
Does C# have regular data structures (without methods)? If so I'd consider
// dunno where this goes, maybe some class in Level.cs
public static Controller Update(Controller s, Level level);

If not, I'd probably prefer the first approach although I'm not fully committed to it. Could a Controller ever be used in two different levels? Would something bad happen if somebody tried to do it?
>>
>>61871989
you ain't gonna do shit and you know it.
>>
>>61872004
i was being sarcastic so you're right
>>
File: problemsolving.jpg (75KB, 660x492px) Image search: [Google]
problemsolving.jpg
75KB, 660x492px
So I decided to read first chapter of problem solving with C before my semester starts and I can't answer most of these "questions". Should I give up now?
>>
>>61872012
>A translates a high-level language program into _________.
is this supposed to be english?
>>
>>61872012
Find a better school.
>>
>>61871737
I thought about it, but I read somewhere that C++/CLI is pretty different from actual C++. Is that true?

I'm only using C# because I'm really familiar and comfortable with WPF. I tried using MFC and it was bad. I also tried C++ Qt, however the designer didn't work for me.
Sooner or later I'm wanna move to C++ completely (code + GUI), but until that happens I have to stick to WPF.
>>
>>61871972
Thanks.

>>61872002
The idea is to only have one level instantiated at a time.
>>
File: psc.jpg (72KB, 613x308px) Image search: [Google]
psc.jpg
72KB, 613x308px
>>61872032
>>61872044
It's my city university in Sweden. There aren't really any other options for me, I checked other university in neighbor city and they use same book for first course.
I mean I'm not surprised they chose this book
>>
File: pug.jpg (246KB, 400x800px) Image search: [Google]
pug.jpg
246KB, 400x800px
>>61872012
1. compiler
2. ide or OS ?
3. loading -> translation -> linking -> execution
4. source code / text
5. parser, code
6. (binary) object
7. (binary) executable
8. software, hardware
9. identifiers
10. persistant memory
11. bits
12. * don\t know*
13. partition table or something like that
14. internet
>>
>>61872032
A ----->compiler<------ is a program that translates a high-level language program into a separate machine language program
>>
>>61872116
>Sweden
Offer yourself to Odin.
>>
>>61872116
it's all here i guess

https://www.flashcardmachine.com/cst-120chapter1.html
>>
>>61871796
>I heard here that smalltalk is a python tier, and therefore I shouldn't use it.
Yes and no, from the performance perspective most likely. Smalltalk is a league ahead because it is a class-based language, and Python, despite having a "class" keyword, is based on the principles of Self (prototypes).
Smalltalk's speed problem is the implementation of the dynamic dispatch. The static type of the receiver is not known at the call sites, so it is traditionally compiled to dictionary lookups with caches, as in Self, instead of method tables like C++. Which places it in the same performance league as Python and its dictionary lookups.
In contrast, Lisps usually have the explicit static type at the call site, therefore they can have fast dynamic dispatch.
>>
> his language doesn't allow you to write macros that automatically generate methods
wow how shit

> (define-simple-class company% object%
([name "<unknown>"]
[employees '() #:list]))
> (define g (new company%))
> (send g add-employee "rob pike")
> (send g get-employees)
'("rob pike")
>>
>>61872169
>methods
>>
>>61872121
where's it say that?
>>
>>61872169
>Lisp object model which does not support multiple inheritance
Disgraceful.
>>
>>61872012
byte code
operative system
translation, linking, loading, execution
executable
parser, tree
object
lib, dll, exe
software (virtual), hardware (physical)
registers
persistent storage
sectors
spiral track
FAT
FBI van outside your house
>>
>>61870766
why are you declaring j and not initializing it berfore use... ?
>>
>>61872169
is this text processing based or do macros need to be semantically correct before usage?
>>
>>61872227
It is initialized before use.
>>
>>61870852
it looks like you are passing values as value and not by reference...
>>
wich are the best technologies for develop a website with users profiles?
>>
>>61872064
>Is that true?
You can't do threads or lambdas or basically any C++11 features, but it works as a glue code. So you have a managed class
public ref class ManagedClass 
{
public:
void DoSomething1();
/* ... */
private:
NativeClass *class;
}

And with it you basically passthrough the native functions. If you need to work with other managed classes in C++/CLI, you have to use special tracking pointers (^):
String ^s = gcnew String("lol");


I think you got the idea. There are some... non-appealing things (sometimes lifetime can be a bitch to handle, passing delegates/lambdas in both directions and some others), but in the simplest cases you won't have to deal with them.
>>
>>61872231
It's Lisp so it's procedural, based on s-expressions, and its mostly hygienic except for the get-X etc identifiers are injected into the context using datum->syntax
https://ghostbin.com/paste/r9xc3
>>
>>61872282
>unhygienic neckbeards using a """hygienic""" language

hwat
>>
>>61870946
I know that feel. I went from being humble and eager to help and learn, to an asshole who teaches snarky people wrong on purpose because of this reason. Now I will only help people if I'm getting paid for it.
>>
>>61872277
Got it.
Thanks man, I will look into it.
>>
>>61872208
(defclass ass ())
(defclass girl-ass (ass))
(defclass ugly-ass (ass))
(defclass your-ass (girl-ass ugly-ass))
>>
>>61870766
>>61871183

This anon got it. j gets increased to say "we moved stuff around, we need another pass". However you don't do another pass because i still has the n - 1 value. j will be 0 and you will exit the while. Also, the final return is redundant.
>>
File: sample haskell code.png (5KB, 629x75px) Image search: [Google]
sample haskell code.png
5KB, 629x75px
>>61872380
>>
>>61872438
>Male < Girl (Other)

>>>/t/umblr
>>
>>61869058
How do you pass a huge structure (sizeof struct > 64 bits) in a register?
>>
File: astolfo.jpg (89KB, 740x488px) Image search: [Google]
astolfo.jpg
89KB, 740x488px
>>61872460
>>
>>61872502
>>>/a/
>>
>>61870167
>only the good ones should die

Never change dpt
>>
File: 1502213428522.jpg (325KB, 730x956px) Image search: [Google]
1502213428522.jpg
325KB, 730x956px
>>61872502
How good do I have to be at programming to get me a bf like this?
>>
https://gergo.erdi.hu/projects/icfp-bingo-2017//

kek
>>
>>61872569
>.hu
not clicking that shit
>>
File: icfp2017 bingo.png (27KB, 781x550px) Image search: [Google]
icfp2017 bingo.png
27KB, 781x550px
>>61872585
>>
>>61872569
That's pretty good.
>>
>>61872603
not smart enough to understand this, but looks pretty cool
>>
>>61869065
>server
>8gb ram
PAJEET GO HOME
>>
>>61872532
>Selfshits
>good languages
https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=yarv&lang2=gcc
https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=python3&lang2=gcc
https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=node&lang2=gcc
>vs the best dynamically typed language to ever exist
https://benchmarksgame.alioth.debian.org/u64q/compare.php?lang=sbcl&lang2=gcc
>>
>>61868582
The only issue I've had using new[] is with conflicting destructors and my unwillingness to use shared_ptrs, probably because I tried to implement them once, the intuitive syntax to me wouldn't compile, and I didn't care enough to push onwards. I figured "this might happen eventually, but not right now".

It really depends on how you write software. I write very slowly. I think about my programs all the time, and only care about maximum efficiency within reason and maintainability. There are times when I won't write a single line of code for many days. Then I'll make multiple non-trivial changes and additions. If you're working with other people, or have a quicker pace, it's generally a better idea to use smart pointers and other basic infrastructure like that.

Generally my attitude is "if you're doing it, you ought to have a good reason. If it's ugly, it's very possibly suboptimal from every relevant perspective." Whether that's about using / not using standard library stuff or not.

I also dislike the disease-like nature that's formed within the C++ STL. To discourage "bad practice". One example is with vectors not being able to easily release their pointer, forcing shitty hacks or unnecessary copies. There are certain times when I just want a vector's resize and element addition machinery, but otherwise will also have all of its other stats stored elsewhere. I don't want duplicate information kicking around. And suddenly you look at any downstream function, and it's written to accept a vector. All of its bounds related stuff is written around calls to size(), capacity(), etc. Often times this results in unnecessary copies, moves, and reallocations. When I know things in advance, I always prefer a fixed buffer. Hell, I've looked at code bases with loops that call functions that literally allocate storage (via a vector) every single call, for the same size, that run hundreds of times. The compiler does not optimize that.
>>
File: dankmemes.jpg (20KB, 306x306px) Image search: [Google]
dankmemes.jpg
20KB, 306x306px
>>61868339
>Buy book on java
>Literally has no samples of code besides showing specific things that java can do
>>
>>61872912
dumb frogposter
>>
>>61872912
dumb frogposter
>>
>>61872912
What were you hoping for?
>>
>>61872908
In my experience, Rust solves some of this since you get slightly better control over memory ownerships so you can reuse, release etc. data types with Vec that you cant do with C++, usually because it took too long for C++ to really introduce move semantics, and because theyre so complicated that people tend to just throw their hands in the air and use a const ref and make deep copies. What do you think?
>>
File: 1439061543070.jpg (162KB, 1920x1080px) Image search: [Google]
1439061543070.jpg
162KB, 1920x1080px
>>61872639
>>vs the best dynamically typed language to ever exist
>* look at the source code *
>* see type declarations everywhere *
>the best dynamically typed language to ever exist
>dynamically typed language
>dynamically typed
>dynamically
>>
>>61872997
Some stuff to walk me through some java apps.
>>
I can't get signal handling working in C++, using MSYS2. Ctrl+C just locks up the terminal. Raising SIGINT internally works fine.

Why is this such a pain in the ass. Literally:
#include <csignal>

bool should_exit = false;

void signal_handler(int sig) {
should_exit = true;
}

int main() {
std::signal(SIGINT, signal_handler);
while (!should_exit) {
if (should_exit)
printf("Exiting\n");
}
}

Does not work.
>>
Working on my lighting controller
>>
>>61873078
Thank you for using Python.
>>
>>61872116
>a recent study by the National Center for Women and Information Technology
gee, I wonder if there was a bias
>>
I'm graduating in December. Should I start applying to jobs now?
>>
File: 1464979494403.png (274KB, 1088x728px) Image search: [Google]
1464979494403.png
274KB, 1088x728px
So bubble sort requires (n-1) + (n-2) + ... + 1 = (n^2-n)/2 which is where the O(n^2) comes from.

Where do some algorithms get O(log n) from? Geometric progression? I've forgotten almost everything about math.
>>
>>61873168
Stop being a sexist misogynist homophobic transphobic islamaphobic MALE.

GOD WHY CAN'T WE JUST CASTRATE ALL MEN.
>>
File: sweetie.png (169KB, 400x400px) Image search: [Google]
sweetie.png
169KB, 400x400px
>>61873193
\sum_{n=1}^{N} \frac{1}{n} \in \frac{O}(\ln N)
>>
>>61873268
your fetish isn't supported here
>>
>>61871772
>buying a free book
>>
File: explosive_brap.png (326KB, 678x506px) Image search: [Google]
explosive_brap.png
326KB, 678x506px
>>61873285
>>
Am I using typedef and enums correctly?
#include <iostream>
#include <string>
using namespace std;

using int = error_t;

enum class parse_errors {
READ_ERROR = 0,
NO_ERROR = 1
};

error_t read_file(const string& path)
{
//unimplemented
return parse_errors::NO_ERROR;
}

error_t parse_file(const string& file_path)
{
if (!(read_file(file_path)))
return parse_errors::READ_ERROR;
else return parse_errors::NO_ERROR;
}

int main()
{
int result = parse_file("/path/to/file");
cout << result << endl;
return 0;
}
>>
File: Untitled.png (2KB, 155x81px) Image search: [Google]
Untitled.png
2KB, 155x81px
>>61873268
wat
>>
>>61873365
Shit it should be \mathcal not \frac in front of the O.
>>
>>61873291
>stealing
>>
Uhm.. so where do you get your books from?
>>
>>61873425
libgen
>>
>>61873193
log n happens if you disqualify a portion of the possible answers every time

like if I asked you to guess a number between 1 and 100
and you guessed 50
and I said that was too high
so you guess 25
still too high
you guess 13
too low
guess 19
too high
guess 16
too low
guess 18
too high
guess 17
got it

if you used that logic like above of guessing right in the middle of the the highest and lowest known bounds it'd take you log(base 2) of N where N is the initial range
this i because we disqualify half of the numbers in that range each time
>>
File: anal beads.png (9KB, 547x111px) Image search: [Google]
anal beads.png
9KB, 547x111px
>>61868339
Discuss.

Birds are not allowed to reply to this post.
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Germany loves dlang-chan!
https://dlang.org/blog/2017/07/28/project-highlight-funkwerk/
>>
>>61872912
dumb frogposter
>>
Is Haskell a meme if I want to be employable? Haven't seen any jobs that ask for it, and I feel like OOP languages are more versatile
>>
So I'm trying to into kernel development and I came across this pattern in include/linux/sched.h. I was wondering if someone could explain to me how this works. In particular, why are they using bit-manipulating operators and powers of two to define these macros? I have sort of figured out that ORing them together will always produce a unique number, but what about AND? Sorry if this is a noob question.
>>
>>61873653
Are you going to get a job writing Haskell? Probably not. Will learning Haskell help you be a better programmer in general? Yes. Is it worth it? Up to you.

If you're looking for a fairly unique language which is also has a decent job market, check out Clojure. It's a Lisp dialect that runs on the JVM and it has seen a good amount of practical success.
>>
Is it possible for objects to have their own data structures in python? E.g. a library class that stores 'Book' objects in a list.
>>
>>61873686
this is a space-efficient way of storing multiple values which aren't mutually exclusive in a single machine primitive

See https://en.wikipedia.org/wiki/Bit_field for another explanation (bitfields have their own problems which is why they tend to be done manually as here instead)
>>
Why is C++ so fucking retarded? I honestly can't get anything to compile and link correctly. Spent all day trying to get some really basic shit working, on several OSes. And I can't get it to work anywhere. All of the how-tos are "works on my machine"-tier. "Just run cmake". Yeah that's good for you since you have all the dependencies, how about you tell me how to fucking get and install them, or at the very least what they are.

>>61873686
This is pretty common for low level applications. They are using one variable as a container for many bools, like an array of bits. Example,

char flags = 0; // this gives us 0000 0000
flags |= 0x1; // this flag decides whether milk tastes good
flags |= 0x2; // this flag decides whether OP is gay
flags |= ... // etc

Then you can pass around, say 32 bools at once by just passing a single int variable.
>>
>>61873771
I'm really tired so my post is a bit incoherent. In the example, after setting flags 0x1 and 0x2, you would have the char 0000 0011.

The reason it's done with defines and so on, is because it's a lot more readable.

(FLAGS & TASK_DEAD) obviously checks if the task is dead. FLAGS & 0x64 is nonsense.
>>
>>61873739
>>61873771
>>61873798

Thanks anons, this has been very helpful. I appreciate it.
>>
>>61873771
>I honestly can't get anything to compile and link correctly. Spent all day trying to get some really basic shit working, on several OSes. And I can't get it to work anywhere.
Wait till you try Rust kek
>>
>>61873686
It's more space efficient and easier to move around. To check a value all you have to do is check if it's non-zero using a mask for the given bit position (flag).

eg pseudocode

flag = 00010100;
if (flag & 00010000)
do_stuff();

As you said, setting the flag is done with the same masking approach, just with ORing. Sometimes this allows you to if any of many conditions are true just by checking if a single byte is non-zero. If any flag is set, it will be non-zero. Also, you can do clever XORing and shifting things, sometimes.

Bitmanipulation machinery can incur a speed penalty in some cases, and if used excessively and without good reason, can greatly increase binary size. Has to be weighed carefully.
>>
>>61873851
>Wait till you try Rust kek

Implying I ever will.
>>
>>61873498
>Birds are not allowed to reply to this post.
Why not?
>>
>>61873498
>he needs full words to understand things
brainlet
>>
File: LinkedLists.jpg (521KB, 1280x1440px) Image search: [Google]
LinkedLists.jpg
521KB, 1280x1440px
Going through a C Algorithms and Data Structures Book... Currently trying to implement a polynomial (with addition/multiplication) using Linked Lists


/*
Given an exponent, n, and a coefficient, a, this method inserts
a * x^n into the Polynomial (implemented as a linked list)

Assumes a Header Node;
*/
void
InsertIntoPolynomial(Polynomial Poly, int Exp, int Coeff)
{
/* Allocates enough space for one new entry in the polynomial */
Node* toInsert = (Node*) malloc( sizeof(Node) );
/* Initializes fields we know enough about to initialize */
toInsert-> Coefficient = Coeff;
toInsert-> Exponent = Exp;
toInsert-> Next = NULL;

PtrToNode Iterator = Poly->Next; /* Iterator points to the first
entry in the polynomial now */

/* Nothing in the polynomial */
if(Iterator == NULL)
/* Insert the polynomial into the header and quit method */
Poly->Next = toInsert, return;

/* Inserting exponent is greater than the current largest exponent */
if(Exp > Iterator->Exponent)
{
Poly->Next = toInsert;
toInsert->Next = Iterator;
return;
}

int curr_exp, next_exp;
PtrToNode Temp;


/* Otherwise... */
while(Iterator->Next != NULL)
{
curr_exp = Iterator-> Exponent;
Temp = Iterator->Next;
next_exp = Temp -> Exponent;

/* If you already have x^n, replace the coefficeint */
if(Exp == curr_exp) Iterator->Coefficient = Coeff, return;
if(Exp == next_exp) Temp->Coefficient = Coeff, return;

/* If your current exponent is between two, insert
the power of x between the two */
if(Exp < curr_exp && Exp > next_exp)
{
Iterator->Next = toInsert;
toInsert->Next = Temp;
return;
}
}

/* If you didn't find somewhere to insert the power of x,
insert it at the end
*/
Iterator->Next = toInsert; /* You're done! */
}
>>
Can someone teach me how to makefile? Ideally I'd want it so that I don't have to add a new rule every time I add another file.
>>
>>61874022
You don't need to learn makefile, use Netbeans or Qtcreator and let the IDE take care of that for you
>>
File: 1480712855290.jpg (86KB, 1200x907px) Image search: [Google]
1480712855290.jpg
86KB, 1200x907px
>want to enjoy some C programming
>have to do webdev instead
Life is suffering.

>>61874002
Sugoi, anon-chan! Are you going to add more operations like basic differentiation?

>>61874022
There are countless resources out there, anon. Just use google (startpage).
>>
>>61874072
Ruby isn't really sure what it wants to be. It takes a bunch of good ideas from different languages and very poorly mashes them together.
>>
>>61874072
memes belong in >>>/g/wdg
>>
>>61873062
Reposting.
>>
>>61874022
Yeah sure. Here's an example:

CFLAGS=-g -Wall -Wextra -pedantic -O2
LDFLAGS=-lcrypto -lsqlite3

OBJ = \
init.o main.o

all: scored

scored: $(OBJ)
$(CC) $(OBJ) -o scored $(LDFLAGS)

%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@

clean:
rm $(OBJ) scored
>>
>>61874089
I kind of want to do a larger calculator project, and I think extending it to differentiation shouldn't be too bad, so sure!
>>
>>61874022
Look in your make's docs for information about pattern rules or wildcard rules.
>>
>>61873953
>needs
There's that word.
>>
File: starstar.png (78KB, 677x180px) Image search: [Google]
starstar.png
78KB, 677x180px
>>61868388
>assignment having a value
(c = getchar()) != EOF

>for loops, if-statements, etc without a body or a single statement without braces is fine
>a single semicolon to serve as a statementt is fine

>no ** exponentiation?

>shittiest brace style

what the fukk the more I read about this language and book the more garbage it appears and I have not finished the first chapter
>>
>>61873062

#include <csignal>
#include <cstdio>

bool should_exit = false;

void signal_handler(int sig) {
should_exit = true;
}

int main() {
std::signal(SIGINT, signal_handler);

while (true) {
if (should_exit) {
printf("Exiting\n");
break;
}
}
}


This works fine for me.
>>
>>61874125
I did not mean to quote
I was too upset to delete the id I opened quick reply with
>>
>>61874125
>>61874146
is the lack of ** only because it would interfere with the clusterfuck that is its pointers?
>>
>>61874097
Sorry I'll move my post there.
>>
>>61873893
"i hate working with this terrible language c++ but i refuse to look at the language which aims to fix all of c++'s bullshit"

Your loss, I guess.
>>
>>61874125
>for loops, if-statements, etc without a body or a single statement without braces is fine
They aren't useless; you can do things such as counting the size of an array with that.

>a single semicolon to serve as a statementt is fine
This allows portable infinite loops like this:
for (;;) {
...
}


>no ** exponentation?
Because of the way pointers work, you can't do it like that. There is the pow() function in the math library though.

>shittiest brace style
No, the GNU brace style is the worst.
>>
>>61874182
Most processors don't include exponent instructions and C is meant to abstract the processors it was written for
>>
>>61874104
Well now you have to add new files to OBJ, right? Also, how do I add this when linking .o files? I know it works when going directly from .cpp to executable, but when I add it to your example, I get undefined reference (i.e. it didn't link correctly)...

`sdl2-config --cflags --libs`

>>61874116
I fear it will take hours to learn how to write a proper makefile... I just want to get started on my project. I was more hoping there was some kind of out of the box solution.
>>
>>61874204
Since when has Rust been easy to build? There are already plenty of stories about how a random update to the rust compiler breaks existing code because they ship out language changes with every release.

Implementation based languages are cancer.
>>
Okay in Java if you have a class that extends JPanel, why can't you add methods to that class and than call them in another class?

Basically I want to call the getTime() and getDistance() methods in another class but it won't let me

import java.awt.*;
import javax.swing.*;

public class RunningPanel extends JPanel {

public JLabel exerciseL;
public JLabel distanceL;
public JLabel timeL;
public JLabel dateL;

public JTextField distanceT;
public JTextField timeT;
public JTextField dateT;



public RunningPanel(){
setLayout(new GridLayout(2,2));

exerciseL = new JLabel("Running");
distanceL = new JLabel("Distance");
distanceT = new JTextField(10);
timeL = new JLabel("Time");
timeT = new JTextField(10);

add(distanceL);
add(distanceT);
add(timeL);
add(timeT);
setVisible(true);

}

public int getDistance(){
int distance = Integer.parseInt(distanceT.getText());
return distance;
}

public int getTime(){
int time = Integer.parseInt(timeT.getText());
return time;
}
}
>>
>>61874244
Use the "-c" flag on your compiler so the object file is generated instead of an executable, then once all of the objects are made the linking process occurs.
>>
>>61874111
Good luck! It should be fun.
>>
>>61874276
Sorry if I misinterpreted your question. If I did can you give me your version of the Makefile?
>>
>>61874244

here is an alternative i just wrote

CFLAGS  += -Wall -Wextra
CC := clang
DEFINES :=

SRCS := $(wildcard src/*.c)
OBJS := $(addprefix build/,$(notdir $(SRCS:.c=.o)))

all: exe

exe: $(OBJS)
$(CC) $(OBJS) -o exe

build/%.o: src/%.c | mkdirs
$(CC) $(CFLAGS) $(DEFINES) -c $< -o $@

mkdirs:
@mkdir -p build

clean:
@rm -rf build

.PHONY: clean
>>
>>61874303
Let me show you what I mean instead:

This works:

g++ -o run main.cpp `sdl2-config --cflags --libs`

This doesn't:

g++ -c main.cpp `sdl2-config --cflags --libs`
g++ main.o -o run
^ This one gives me undefined references to SDL_Init, etc.

I guess I'm misunderstanding how .o files work.
>>
File: terrain.png (44KB, 320x240px) Image search: [Google]
terrain.png
44KB, 320x240px
>>61868339
This planet-surface-generation algorithm is fairly cool: https://donjon.bin.sh/code/world/

Unfortunately, however, its results aren't all that realistic. Each mountain corresponds to a valley at its antipode (on the other side of the world), so all the land tends to coalesce into one big Pangaea.

Pic related (Lambert cylindrical equal-area projection).
>>
>>61874351
You need `sdl2-config --libs` during the object linking stage, and `sdl2-config --cflags` during the source to object compilation stage.
>>
>>61874351
Okay, I understand what you mean. Append this to your CFLAGS:
$(sdl2-config --cflags)

and this to your LDFLAGS:
$(sdl2-config --libs)
>>
>>61874370
to add, the first example compiles all sources to object files then performs the linking phase all in one

the second example creates the intermediate object file then links them in a secondary command. this is useful because we can the just recompile just the object files we need and perform the linking stage instead of recompiling everything
>>
What's your preferred development environment /dpt/?
>>
>>61874442
I use vim, cscope, etags, clang, gdb / lldb, valgrind, and portable Makefiles (sometimes I'll begrudgingly use autotools if there is a lot of things that need to be managed)
>>
>>61874224
I would probably have chosen a for construct like for(start,end,step) desu and left infinite loops to while to make it explicit
>>
>>61874141
Hm. Will test momentarily.

Any idea why that would make a difference?
>>
>>61874370
>>61874378
Oh, that's how sdl2-config works. I see.

Thanks guys, I put your solutions together and got it working. Here's what I ended up with for now:

CC = g++
CFLAGS = -std=c++0x -g -Wall -Wextra `sdl2-config --cflags`
LDFLAGS = `sdl2-config --libs`

SRCS := $(wildcard src/*.cpp)
OBJS := $(addprefix build/,$(notdir $(SRCS:.cpp=.o)))

build/%.o: src/%.cpp
$(CC) -c $(CFLAGS) $< -o $@

all: $(OBJS)
$(CC) $(OBJS) -o run $(LDFLAGS)

clean:
rm $(OBJS) run
>>
>>61874492
in your first example it is possible to be interrupted between the checks and exit with not message.
>>
>>61874483
I recall reading that infinite loops using
while(1)
aren't portable, I'll try to find the source of that.

>>61874510
No problem, glad to help.
>>
>>61874542
>>61874483
Never mind, while(1) loops are just fine. My style just required infinite loops to be done using for(;;).
>>
>>61874257
When they stop rolling out breaking changes (I haven't had any breaks like that, I think its stabilizing out), it will have (it already does) and extremely easy to use build system. Meanwhile its been decades and building and setting up C++ projects still fucking sucks
>>
File: terrain.png (46KB, 320x240px) Image search: [Google]
terrain.png
46KB, 320x240px
>>61874357
Here's a version with fewer slices. It's as if a battle of the gods left scars on the landscape...
>>
File: elevation.png (44KB, 320x240px) Image search: [Google]
elevation.png
44KB, 320x240px
>>61874664
It's even more apparent in black and white.
>>
What language should I learn to get into programming /dpt/?
>>
File: frog tech.jpg (105KB, 794x674px) Image search: [Google]
frog tech.jpg
105KB, 794x674px
>>61874964
Gentoo
>>
>>61874964
D
>>
>>61874964
D
http://ddili.org/ders/d.en/
>>
>>61875053
>>61875045
quit the memes anons
>>
>>61874964
scheme

use "the little schemer"
>>
>>61875062
Why do you think it's a ``meme``?
>>
>>61875079
is dead
>>
New thread:

>>61875133
>>
>>61875128
And?
>>
>>61875128
Looks pretty alive to me
>>
>>61875160
>>
I wouldn't recommend getting into programming with D. When I was learning D it seemed like half of the docs were "here's how this feature is better than C++, it's just like C++ but different in ways X, Y, Z"
>>
>>61875301
If you are reading "D for C++ programmers" that's what you should expect, hence you should read the D book
>>
>>61873062
It's impossible to make signal handling work anywhere kiddo. With a LOT of work and inherently unportable features, and I mean a LOT... You can get something that somewhat approaches sane.

C's little signal() function doesn't stand even a snowball's chance in hell.
>>
>>61873168
Do you have access to the study? Can you post a screenshot of its methodology section
>>
>>61875992
>Do you have access to the study?
no
>>
>>61874357
>>61874664
>>61874691
That's really cool!
>>
File: 1489019564047.jpg (128KB, 502x449px) Image search: [Google]
1489019564047.jpg
128KB, 502x449px
Should I learn Go?
>>
>>61876107
no

learn malbolge
>>
>>61876107
if you don't have a project in mind, probably not
>>
how do i print an integer in visual studio?

OutputDebugStringA only works for strings
>>
File: SumatraPDF_2017-08-12_22-32-36.png (566KB, 857x975px) Image search: [Google]
SumatraPDF_2017-08-12_22-32-36.png
566KB, 857x975px
>>61868339
I'm taking the first steps into learning C after learning Python with this book, on chap 1.3 right now. c:
Thread posts: 326
Thread images: 44


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