[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 16
File: dpt_.png (147 KB, 2000x2810) Image search: [Google]
dpt_.png
147 KB, 2000x2810
Welcome to /dpt/.
Prev thread: >>51239192

What are you working on, /g/?

# New & Revised /dpt/ Code of Conduct #
We want to ensure that the /dpt/ community, while large and diverse, remains
welcoming and respectful to all participants. To that end, we have a few
ground rules that we ask people to adhere to.

- *Be friendly and patient.*

- *Be welcoming.* We strive to be a community that welcomes and supports
people of all backgrounds and identities. This includes, but is not limited
to members of any race, ethnicity, culture, national origin, colour,
immigration status, social and economic class, educational level, sex,
sexual orientation, gender identity and expression, age, size, family
status, political belief, religion, and mental and physical ability.

- *Be respectful.* Not all of us will agree all the time, but disagreement
is no excuse for poor behavior and poor manners. We might all experience
some frustration now and then, but we cannot allow that frustration to turn
into a personal attack. It’s important to remember that a community where
people feel uncomfortable or threatened is not a productive one. Members of
the /dpt/ community should be respectful when dealing with other members as
well as with people outside the /dpt/ community.

- *When we disagree, try to understand why.* Disagreements, both social and
technical, happen all the time and /dpt/ is no exception. It is important
that we resolve disagreements and differing views constructively. Remember
that we’re different. The strength of /dpt/ comes from its varied community,
people from a wide range of backgrounds. Different people have different
perspectives on issues. Being unable to understand why someone holds a
viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to
err and blaming each other doesn’t get us anywhere. Instead, focus on
helping to resolve issues and learning from mistakes.
>>
First for X#.
>>
C is the greatest language of all time, and nothing will surpass it for writing fast, clean, understandable code.
>>
>>51244442
Fast? Maybe you're right but clean and understandable? That's a joke m8. C is obsolete garbage nowadays.
>>
Ada is better than any C deriative.
Wirthian languages > C(uck) derivative languages.
>>
>>51244454
It's spelled "absolute", go back to third grade
>>
>>51244454
What other language (besides Lisp) can you learn in its entirety in a few hours of skimming through a book?

If you can't understand C code, you aren't cut out to be a programmer.
>>
>>51244464
kek'd tbqh
>>
>>51244464
http://dictionary.reference.com/browse/obsolete
>>
>>51244473
>What other language (besides Lisp) can you learn in its entirety in a few hours of skimming through a book?

go
>>
>>51243483
are you really still stuck on this since yesterday?

here you go, your homework

#include <iostream>
#define ROWS 5
#define COLS 5

int main() {

int matrix[ROWS][COLS] = {
{1, 2, 3, 4, 5},
{5, 6, 7, 8, 9},
{10, 11, 12, 13, 14},
{15, 16, 17, 18, 19},
{20, 21, 22, 23, 24}
};

for (int row = 0; row < ROWS; row++) {
if (row & 1) { // row is odd
for (int col = COLS; col--; ) { // loop backwards
std::cout << matrix[row][col] << " ";
}
}
else { // row is even
for (int col = 0; col < COLS; col++) { // loop forwards
std::cout << matrix[row][col] << " ";
}
}
std::cout << std::endl;
}
}
>>
>>51244529
Unfortunately Go is objectively shit. K erred; what a sad legacy.
>>
Lets say I want to get into statically typed languages boring enterprise programming. Which one should I learn, Java or C#? Seems to me like Java is far more used (more jobs) and it's platform independent but C# and ASP.NET look better designed, less overengineered than Java EE and more fun.
>>
>>51244473
jQuery
>>
>>51241503
Have you tried doing the transfer over multiple connections, then? Keep an IP (or such) in a DB with the partial content received so far, remove the record when done.
>>
>>51244530
>using macros instead of consts
>>>/trash/
>>
>>51244442
It's just a high level assembly language. As such it should only be used for little applications with no complexity.
>>
>>51244596
>unironically using shitty C++ language features when you could be C compatible at no cost
Fuck you.
>>
>>51244569
C# is platform independent and the third most used programming language right now (#1 is C++, #2 is Java).
C# has more of a future, Java has more of a past. The syntax for the two are extremely similar. Pick your poison.
>>
>>51244600
But you can write anything in C pretty easily. There are many games written entirely in C. Many engines. Many large software projects.

I'd argue that if you're a solo programmer, C is the best choice. If you have to collaborate with others, then you probably need a more restricted language to get stuff done efficiently. But by yourself, C is amazingly productive.
>>
>>51244473
You can learn C in a few hours, but only C89, and only a subset of it. Moreover, learning C is so far from mastering C to the point you could use it on a serious project that you might as well call it "learning fantasy C". MIPS and ARM assembly are both a fuckload easier to learn, so are all lisp languages, or even C++. Then there are the obvious java, python, C#, julia, opendylan and ocaml. I hesitate to say it's also true of x86 assembly but I think it is. I think haskell and esoteric languages are the only ones you can't learn to a useful proficiency level faster than C, really.
>>
>>51244609
>const
>C++ feature
Cmen everyone!
>>
>>51244627
>C++ is easier to learn than C
But anon, the best C++ code is literally C code. How can it be easier to learn than C?

Also, you really don't need to be a C master to program large, serious projects in it. I don't know how people reach this misconception. My first "major" C project was a neural net library that I wrote in C after a month of experience. It was 12000LOC and I still use it today (with some modifications).
>>
>>51244621
>But you can write anything in C pretty easily.
No. "It can be done" != "it can be done easily". Only fizzbuzz can be done easily in C. Anything else is needlessly complex. Also, I don't count a program that leaks buckets of memory and is prone to buffer overruns to be done.

>There are many games written entirely in C.
There are many games written entirely in assembly. A fuckload more than there are, written in C, too.

>Many engines.
Most are written in C++.

>Many large software projects.
There are maybe 10 large C software. The rest are C++ or java.
>>
>>51244636
>implying the performance hit associated with a const vs a straight up define is worth it
>>
>>51244609
>unironically using macros
>>>/trash/
>>
>>51244612
I guess I'll focus on C#. I have some little experience using C# from modifying an internal application in my previous job so that'll help me when searching for a job I presume. But I'm fearful that a couple of years from now I'll look back and say "I should have focused on Java or another X language" because Microsoft becomes irrelevant or some shit.
>>
>>51244648
How does C++ make writing a game any easier than writing it in C?
inb4
>muh OOP

Only retards who think OOP and classes are necessary seem to think Java/C++ are "easier" than C. I actually write C++ as my day job, but I sure as shit don't use any OOP or classes, and 95% of my code is C-compatible.

Leaking memory is a bad joke. It's literally not an issue if you aren't incompetent. Use memory arenas and a free list and enjoy you're huge performance benefits. Follow C idioms (like allocating memory in one place and passing it around to functions instead of letting functions allocate their own shit) and you won't have any trouble.

>>51244679
Not that anon, but what's the problem with macros? The lack of type safety? Because that's not an issue at all.
>>
File: 1405623755361.jpg (21 KB, 400x252) Image search: [Google]
1405623755361.jpg
21 KB, 400x252
CHALLENGE OF THE DAY

>Write a script in your autist language of choice that processes the first 9 pages on /g/, grabs 80 characters from the first post on each page and prints it out. You must do it in 17 lines or less, without cheating by putting everything on one line, and it must be faster than 608ms.
>>
>>51244648
GTK+ is written in C. That alone proves that C is worth something.
>>
File: téléchargement (4).png (5 KB, 303x121) Image search: [Google]
téléchargement (4).png
5 KB, 303x121
>>51244389
Doing ANSI C component testing with the shitty tool from IBM.
This is hell.
>>
>>51244686
MS is focusing hard to branching off the .NET family from Windows. They OSS'd the CLI recently which means that Mono might soon be replaced by a fully-MS.NET-compatible CLR.
>>
>>51244690
>inb4 someone uses a meme language with web support in the standard library and pretends that it's not >2000 LOC
These tests are so stupid. If you allow black box functions like the ones in the standard library then line limits make no sense.
>>
>>51244686
>I'll look back and say I should have focused on Java
No way.
>Microsoft becomes irrelevant
Before they started open-sourcing .net and switched to roslyn that was a risk. Not now though.
>>
>>51244689
Macros are a problem because they can easily break things without it being obvious why it's broken.
>>
>>51244695
>GTK+
>worth something
Everyone worth their salt is switching to QT.
>>
>>51244718
>he doesn't wrap all of his macros in parentheses

Otherwise I'm not sure how they can "break things".
>>
>>51244695
GTK is some of the most un-C like C I have ever used.
>>
>>51244647
And your library leaks memory like shit, is slower than python frameworks, doesn't support any of the features a NN library is expected to provide, doesn't even do AD nor SD, is completely unmaintainable, and doesn't even provide correct results depending on the order of operations.
>>
>>51244722
True, but Qt is bloated as fuck. Anyone who's ever done a minimal linux installation and then built their own desktop knows that. You'll eventually hit that ONE program that requires the entire Qt framework, and suddenly you're downloading 2-3GB of dependencies.

I love working with Qt, but it's a mess.
>>
>>deleted-post
This is what happens if you rename functions without undefining them.

(defparameter *m* '(( 1  2  3  4)
( 5 6 7 8)
( 9 10 11 12)
(13 14 15 16)))

(defun parse-matrix (f m)
(loop for y from 0
for row in m
when (= 1 (mod y 2))
do (setf row (reverse row))
do (mapc f row)))


CL-USER> (parse-matrix #'print *m*)

1
2
3
4
8
7
6
5
9
10
11
12
16
15
14
13 NIL
>>
>>51244659
There is no performance hit.
>>
>>51244726
Eventually you reach the point where you're spending more time trying to make sure your macros are safe then you would just using a const.

Macros are acceptable when you need to macro in a LOT of code within a specific scope. There's really no other need for them.
>>
>>51244736
>downloading 2-3GB of dependencies.
jesus christ. WPF fits inside a 40mb installer. What the fuck?
>>
>>51244726
Parentheses have nothing to do with it. Also the common trick is to use do { stuff; } while (0) so that ; can be used without killing everything and an error is emitted correctly if it's missing. Still, it kills debugging efforts.

>>51244689
Cmen pls go.
>>
>>51244736
Bloat isn't a valid excuse on modern computers.
>>
>>51244734
Pretty big claims for some software that you have not used and have never seen it's code.
>>
>>51244734
>slower than python frameworks
Doubt it. I actually just spent a while optimizing it as an excuse to familiarize myself with AVX512. You're right it probably doesn't support features that most people want, but I know the library like the back of my hand and anything I need I can implement in a few hours.

I use static buffers and memory arenas so there's zero memory leakage, and no need for GC.

I'm sure it's unmaintainable for anyone other than myself, but that literally doesn't matter. It's a library I use in my own projects, it's faster than the alternatives, and I understand it well.
>>
>>51244740
but there is anon. const are not really constants. static ones might be placed in a read only memory and that is all. it is still in memory.
>>
>>51244747
So does Qt. He's a fucking moron who confuses Qt with KDE libraries. Because once something depends even on one of the low-level KDE libraries you're essentially installing the whole desktop. Say what you want about GNOME, but at least they got this shit right.
>>
>>51244733
Yeah and Qt is so distant from normal C++ that they replaced std::string with their own implementation.

>>51244747
WPF also relies upon the entire .NET Framework as well as the Windows API. It's just that that stuff is all included within Windows, usually.

Qt not only includes the entire graphical framework for Qt GUIs, but it also includes its own version of stdlib designed to work well with GUIs, as well as a shit ton of other functions and libraries and graphical libraries and whatnot. It's a HUGE framework, and because it very rarely gets baked into the underlying system it all has to get installed at once. There's a reason LXQT is noticeably slower than LXDE.
>>
>>51244747
>not coding your own immediate-mode GUI
Jesus christ, so many plebs here.
>>
>>51244763
>it's CPU-only
Even in 2010 that wasn't acceptable. Top fucking kek. Confirmed for doing literally nothing with this library.
>>
>>51244771
Your whole program is in memory. So your #define is also just in memory.
>>
>>51244757
It is when you have a 400KB/s internet connection and don't want to spend three hours waiting to download dependencies just so you can start using TeXStudio or some other meme program.
>>
>>51244763
>, it's faster than the alternatives,
Even the most amateurish alternatives are faster, guaranteed 100%. You obviously don't even know the first thing about neural nets or associated software.
>>
>>51244779
>WPF also relies upon the entire .NET Framework as well as the Windows API
The 40mb installer includes WPF and the .NET framework. QT relies on the Windows/Linux API too.
>>
>>51244783
I've actually thought of doing that a few times. WPF is slow as shit. There's nothing as fast as cocoa UI kit available for windows.
>>
>>51244762
Just seeing the LOC kinda confirms it 90% of the claims. The other 10% is almost guaranteed by the language being used being C.
>>
>>51244787
#defines are literals though. they are with the instructions in executable part. const variables need another dereference
>>
>>51244788
You only need to download it once. Just leave it overnight or something.
>>
File: shaep.png (25 KB, 1000x522) Image search: [Google]
shaep.png
25 KB, 1000x522
>draw 5..5000 random points
>find the smallest polygon that fits all points within

im gonna work for video games, this only took me 18hrs
>>
>>51244824
That sounds like something that shouldn't take longer than 2 hours at the most.
>>
>>51244824
wow, congrats. you implemented a convex hull algorithm.
>>
>>51244816
lol
>>
>>51244824
wtf are you doing? Just connect all the outermost dots and then slightly expand the shape.
>>
File: shaep2.png (64 KB, 1501x772) Image search: [Google]
shaep2.png
64 KB, 1501x772
>>51244837

I wanted to do Jarvis Walk hull algorithm and it took me like 8 hours of debugging. When I had enough, I went with Quickhull and was done in 30min. I'm new to C, actually this is my first project in it. If you took out all hours of research and all hours wasted on JW, probably 3-4 hours.
>>
>>51244849
>find the smallest polygon that fits all points within
>slightly expand the shape.
I'm not sure you understand the problem anon
>>
>>51244849
>Just connect all the outermost dots
that is the whole question anon
>how to do x
>"just do x"
>>
How come C/C++ doesn't support arbitrary-length integrals?

My shitty fibbonacci sequence calculator is hitting the upper limits of what `unsigned long long int` can provide.
>>
>>51244882
Because they're very shitty languages.
>>
>>51244882
How come CPUs don't support arbitrary-length integers? Fucking CPU makers, making us implement this bullshit in software! Fuck those guys, right?
>>
>>51244892
Other languages have arbitrary precision numbers. Fuck off, Cshill.
>>
>>51244892
If it's a hardware issue, how come other languages can do it?
>>
>>51244910
>other languages hide stuff from you
>clearly every language, even ones which try to give you power as a programmer should do the same thing!
Fuck off, Py-kek.
>>
>>51244923
>limiting the value of numbers that you can use
>somehow this empowers the programmer

cshills literally believe this
>>
>>51244918
C++ can do it with a bignum library just like any other language

It just doesn't do it by default because that's retarded
>>
File: chese.png (91 KB, 225x301) Image search: [Google]
chese.png
91 KB, 225x301
>learn so much shit about trees
>MST, AVL, B+ trees
>tree optimization
>take literally two fucking courses in just trees, lists, registers, etc

Is this at all useful? I know a CS degree isn't so much about useful but rather expanding knowledge, but this seems like such a waste of time.
>>
>>51244934
Hm... if only there were libraries that offered arbitrary numeric precision in C and you could pick and choose from different implementations... or code your own. Too bad that's impossible for the typical code monkey who just copies and pastes from Stack Overflow.
>>
>>51244918
They don't. They just provide libraries with BigInt implementations. So does C, C++.
>>
>>51244934
>>51244918
C is a very simple language. adding big integers to standard library would be a big wtf

I don't know why C++ doesn't have it but I doubt that big integers are something you need for every day use.
>>
>>51244961
Yes they most certainly do. I'm sorry that you still believe that library-oriented programming languages are ubiquitous.
>>
>tfw I love to code in Java
stay mad plebs.

;)

keep masturbating to obscure niche languages without documentation or tutorials.

stay pleb.
I'll be making the new minecraft while you keep masturbating to drawings.

;)
>>
>>51244972
>Yes they most certainly do.
What ones do?
>>
>>51244972
>I'm too retarded to pick the best library for the job
>wahhh the language devs better do it all for me!
Given the shitty state of the C++ standard library, I'm glad they haven't tried to shove in even more shit than they have already.
>>
>>51244977
>implying that making minecraft is remotely an achievement

>>>/trash/
>>
>>51244977
;^)
>>
>>51244986
Why cares if it's an achievement if it makes you rich as fuck.
>>
>>51244979
Haskell.
>>
>>51244979
I believe python is an example. its basic integer type has no limit.

not saying this is a good thing, pretty retarded imho. adding overhead to every single integer operation
>>
>>51244977
Even notch said C# was superior to Java.
>>
>>51244998
>I like writing in an imaginary meme language that is then translated to a real language that people actually code on, so it can be compiled and executed on the CPU
>>
boy I sure love spending hundreds of cycles adding 1+1 because the language defaulted to an arbitrary precision type instead of letting me choose
>>
>>51244986
>making more money than some poor countries is not an archievement
ok pleb
>>
>>51244997
Have fun being a rich code monkey, then.
I'll be over here poor but with my pride intact.
>>
>>51245010
>language that is then translated to a real language

Literally every language.
>>
>>51245010
Well thanks for telling everyone that you have no idea how Haskell works.

You can't really write code in C-- and nobody does. Hell GHC gets really mad at you if you try to tell it to just give you the C-- code.

Also, thanks for moving the goalposts so far away from the original point about integrals that you might as well have just said outright that you don't have an argument.
>>
File: Untitled.jpg (241 KB, 1840x884) Image search: [Google]
Untitled.jpg
241 KB, 1840x884
>take an intro to assembly course
>pic related is middle of the year assignment

Why is this allowed?
>>
>>51245034
>integrals
Please stop using that word in this context. You're triggering me.
>>
>>51245018
And thus anon spent the rest of his days being poor and living in his basement, his pride fully intact, being bitter about code monkeys.
>>
>>51245017
>money is literally more important than self-worth or idealogical integrity

code monkeys actually believe this
>>
>>51245038
that is sad.
>>
>>51245003
Never knew that. Though that has a very obvious performance penalty.
>>
>>51245043
I'd rather have spiritual purity than money. I'm not a whore, willing to just sell my intellectual capabilities to the highest bidder. Or, in the case of the code monkey's daily routine, the lowest bidder.
>>
>>51244771
>>51244812
Do you actually believe this retarded shit you just wrote?
>>
>>51245046
>muh comunism
kek literally mentally ill fags.
>>
>>51245073
>muh shekels
kek literally spiritually vacant whores.
>>
>>51245069
which part of it is incorrect?
>>
>>51245089
The part where you claimed that const doesn't get compiled directly into the code, just like any defined value.
>>
>>51245103
>text replace (i.e., #define) vs. expecting the compiler to optimize for you
I know which one I'll choose.
>>
>>51245089
literally 100% of the parts where you wrote about constants
>>
>>51245083
>money is wrong
LOL
literally all freetards desire to be hobos like their homeless fat god.
>>
>>51245083
Why do you hate minecraft thought? What part of it goes against your spiritual integrity?
Isn't shitposting far worse for your spirit, whatever that is?
>>
>>51245122
I'd rather be a free hobo than a slave.
>>
>>51245115
>damage control
>>
>>51245103
const int t = 5;
int& t2 = static_cast<int&>(t);
t2 = 4;

does not look like a literal to me. sure a compiler can optimize it and replace it with a literal if it can figure it is an actual constant
>>
>>51244690
I had to pull an external library with NuGet (HtmlAgilityPack, having tried if it can load html directly from a server), but it werks and I enjoyed making it. Less arguing about which language is better and more coding and challenges pls /dpt/

using System;
using System.Net;
using HtmlAgilityPack;
class Program {
static void Main(string[] args) {
var client = new WebClient();
var doc = new HtmlDocument();
for (int i = 1; i <= 9; i++) {
doc.LoadHtml(client.DownloadString("http://boards.4chan.org/g/" + (i == 1 ? "" : i.ToString())));
foreach (var node in doc.DocumentNode.SelectNodes("//div[@class=\"post op\"]/blockquote[@class=\"postMessage\"]")) {
Console.WriteLine(node.InnerText.Length <= 80 ? node.InnerText : node.InnerText.Substring(0, 80));
}
}
}
}
>>
>>51245125
It's a game designed for autistic people to feel like they can have some control over their surroundings.

I'm not even joking, that's literally what Minecraft is for. So if you're autistic (in the literal sense, not in the 4chan meme sense) then sure go play it.
>>
>>51245126
>a mutually agreed upon contract means you're a slave
So you deliberately sign contracts where you become a slave? I don't see much of that "intellectual capabilit[y]" in your posts, anon.
>>
>>51245083
>not providing value to society by working a job
>instead survives off charity money granted to him by the governement, funded by other people who actually work, money that could be going to children's hospitals.
If you want to be actually spiritually enriched, you could refuse all money from the government and live off the grid self dependently.
>>
>>51245136
>talking about C
>pulls out some disgusting C++ monstrosity that makes me want to strangle myself
T-thanks anon.
>>
>>51245126
>he thinks he's free when the jews already control the world
unless you're living in a mountain like an ermit, you're not free fag.
>>
>>51245144
I wasn't talk about C but you can replace int& with a int* and replace static_cast with a c cast
>>
>>51245139
I don't like it, but I know a lot of literally normal kids who play it. Even if it were for autists, maybe if you're not a kid anymore and you play it you are one, what's wrong with doing something for them?
>>
>>51245141
>literally believing that wageslaves choose to become wageslaves
>bluepilling this hard
>>
>>51245143
>taking money from the government
Do you think I'm some sort of NEET?
>>
>>51245161
So you're saying someone forces you to sign contracts? Maybe you should go see a professional.
>>
>>51245139
>It's basically virtual legos
>kids fucking love legos
>kids bother their parents to buy it because they're too noob to pirate it
>youtubers hope on the bandwagon
>kids now play the game their friends play
>schools are starting to use it to teach kids
>somehow it's autism

It's literally lego: the game, anon.
>>
>>51245174
Fuck you, building things is autistic. You aren't allowed to be creative motherfucker.
>>
>>51245170
If you don't work, then how do you live?
>>
>>51245188
>he doesn't have wealthy, bed-ridden grandparents he takes care of in return for inheritance
So many plebs here.
>>
>>51245188
my mom cares for me
>>
>>51245136
In what compiler would this code even work?
And how does it prove that constants use isn't compiled into immediate values and that that's what constants are used for by 100% of the sane people?
>>
>>51245171
Though coercion, yes. The healthy human mind would not agree to sign away their rights if even the choice in a vacuum. Society has been set up in order to coerce the poor into making that choice, because they are taught to believe that there is no better alternative. In that sense, it is not a choice for the wageslave, because the choice has already been made for him.
>>
>>51245185
kek
another creatively bankrup faggot.
>>
>>51244530
>not creating that matrix using a for loop
>>
>>51245202
What happens after your mom dies? Do you think your mom is bad for working so she can support you? You should refuse her support if you are spiritually opposed to people working.
>>
>>51245212
>>>/x/
I'm sure you listen to alex jhones.
fag
>>
>>51245229
Not that anon, but it's a simple fact that 99% of jobs in our current society are fucking redundant. Pretty much everyone outside of farmers and the people who maintain the infrastructure that the farmers rely on, and that delivers food to the people, are wholly extraneous.

We could shoot every marketer and salesperson and the world would be better off.
>>
>>51245229
So much for his integrity.
Nothing more than a parasite for all the people around him, even exploiting those who love him.
The lowest form of a human being.
>>
>>51245188
The question you just asked is a sentiment held by the many. However, the fact that you asked it means that on some level you don't believe that there is no answer. That's good.

It's entirely possible to live "outside" society. You get your food from either what you can grow yourself or what you can find. You get your shelter from anything that's reasonably comfortable. It's exponentially easier the more people you have with you. Four or five should be enough to become sustainable.

You only believe that you need a job, house, car, etc. because society has told you that you do. They have told you this because the people who run society are the people who benefit from you wanting these things. The banker who makes a shit ton of money from that house you bought, or the company who gets to pay you minuscule amounts of money compared to the value of the goods you're actually producing.

It's not easy to just walk away. But freedom isn't easy.
>>
>want to program
>start Visual Studio
>suddenly my Community license is invalid
>says I can't change my Visual Studio license from within this application and that I should start Visual Studio

>close it
>reset my profile
>start Visual Studio
>it crashes
>start Visual Studio
>license invalid again
>uninstall Visual Studio

>install Xamarin Studio and use it for a day
>it's somewhat unintuitive but does everything I need and has significantly better syntax highlighting

>never have to wait half an hour to install a text editor and 6GB+ of unwanted Microsoft adware again
>>
>>51245212
What's the better alternative?
>>
>>51245251
>i came for the programming
>i stayed for the 12 year olds espousing their misguided political ideas
>>
>>51245251
Farmers are redundant, too. They're not needed when everyone's living in caves around campfires and growing their own plants and hunting wild animals.
>>
>>51245212
Oh please. Alex Jones is a conspiracy theorist. I am not a conspiracy theorist because I don't pretend to know about things that other people don't. Nothing I say is conjecture. Nothing I say is based on whispers behind closed doors. It's all very clearly laid out fact. You can ask any business executive, any bank, why they do what they do and they'll support what I've said here today.
>>
>>51245265
>not using the best debugger
>not using an external editor like emacs, then compiling with MSVC
So pleb.
>>
>>51244950
All of that is extremely useful
>>
>>51245207
[source] const int t = 5;
int* t2 = (int*)&t;
*t2 = 42;
printf("%d\n", t);[/code]
gcc compiles it for me
>And how does it prove that constants use isn't compiled into immediate values and that that's what constants are used for by 100% of the sane people?
you can check its address and see it is on stack (assuming it is a local const). also if you can change it, it is not in executable memory (or you are using a compiler which does not mark executable memory as read only and have bigger problems)


the real point is #defines are guaranteed to be literals while const values are not. if they are not and then there is a performance hit.
>>
>>51245251
>>>/alex jhones/
>>>/david wilcock/
>>>/benjamin fullford/
>>
>>51245298
If you actually cared about performance you wouldn't write C in the first place you moron.
>>
>>51245319
>this is what strawmen actually believe
>>
>>51245264
you know society also produces goods and services so you can consume, right?

you know I rather have other people grow food instead of me?

or other people to provide services like hospitals?

or other people building stuff for other people to make their chinese cartoons I fap to?

you seriously believe that living like a cavemen is better than my neet life because it's more free?
>>
>>51245298
The code was in c++ but thanks for participating?
>const values are not
Yeah if some retard casts the const'ness away. because of his retardation. But that doesn't really happen often.
>>
>>51245136
Pretty sure you have to
const_cast 
, anon
>>
>>51245282
I never needed a debugger
You're the pleb if you do
>>
>>51245251
I can't agree with this. I do not wish any ill will upon the lost souls. The wageslaves themselves are not to blame. As I said before, they did not chose to become a wageslave, the choices were made for them.

It isn't nefarious. I don't hate the powers that be. I hate the system. They're part of it, too. Most of them didn't CHOOSE to become harbingers of the machine. They just kinda were. The machine has been around for well over a century - its pioneers are all long gone.

>>51245261
I agree. This is why I do not rely upon any single other person for sustenance. That isn't freedom, that's just putting your lifeline somewhere else.

>>51245266
Unplugging. The first step is understanding that every thought you have ever had, including this one, is a direct result of the society you have been living in. From there you have to decide what you actually want. Not the "you" that you put on your resume, but the you that's inside your head.
That's not a thought I'm doing to think for you, anon, because it'd defeat the entire purpose of freedom. Don't ask me what you want - if you do, you're no better off than asking the television or billboards on the side of the road.
>>
>>51245325
>depending on loop to be correctly optimized by the compiler
>depending on function calls and basic operations being correctly optimized by the compiler
>complains about performance loss when being uncertain whether "const" gets optimized or not
You're a special kind of retard, aren't you?
>>
>>51245264
>You get your food from either what you can grow yourself or what you can find.
Good luck finding land for can grow stuff on that isn't owned by someone else who would rather you didn't in the first world.
>You get your shelter from anything that's reasonably comfortable.
Such as? What's "reasonably comfortable" to you? Can you provide a simple example?

>You only believe that you need a job, house, car, etc. because society has told you that you do.
No, it's because doing a 9-5 job, being well paid and using the money to buy a warm comfy house, enjoying tasty healthy food and having lots of free time to spend with friends, family and my hobbies, sounds a lot nicer than living a in cave and spending all my time looking for food, and hoping i don't get meaningfully sick ever and die from it.
>>
File: 1392735784444.jpg (36 KB, 480x557) Image search: [Google]
1392735784444.jpg
36 KB, 480x557
Went from Python to java
Holy fuck JAVA is one big fucking mess

i don't like this
>>
>>51245338
>he needs a compiler
>he doesn't manually assemble his code into opcodes
>>
>>51245319
well, since it is obvious you are out of arguments we can agree on const has a potential performance hit and I am the one correct on internet. good day sir.
>>
>>51245336
Yeah, but it will still compile into 'mov register, 5'
>>
>>51245357
see >>51245341
>>
>>51245343
yep, pretty much. Try C# instead. Not quite as popular, but very popular. And not a clusterfuck either.
>>
>>51245336
yeah my bad
>>
>>51245341
>he doesn't use the 'register' keyword
>he doesn't use compiler intrinsics
>he doesn't use ispc
>>
>>51245366
irrelevant. I am still right and you are wrong.
>>
>>51245357
>const has a potential performance hit
No it doesn't unless you cast away const'ness. If you cast away const'ness you literally making a constant behave like not a constant, which makes a potential performance hit not a problem of constants but a problem of your retarded use of the language
>>
>>51245373
None of those guarantee that the code gets optimized. In fact, the compiler may ignore the register keyword completely when it feels like it.
>>
>>51245351
Using Assembly for anything other than analyzing compiler output for performance bottlenecks is highly unproductive
You're the autist if you do
>>
>>51245389
>>const has a potential performance hit
>No it doesn't unless you cast away const'ness
so... are you saying const has a potential performance hit?
>>
>>51245400
>you're an autist if you like building things yourself
>come on, just use this libraries and language features, goy
>>
>>51245332
Why would I consume them, though? Why is consumption somehow an inherently good thing?
As I said earlier, you only believe that because you live in a society that needs you to believe that in order to function.

You don't NEED luxury goods. You don't NEED chinese cartoons and you certainly don't NEED to fap. Learn to let go.

>>51245342
>Good luck finding land for can grow stuff on that isn't owned by someone else who would rather you didn't in the first world.
You'd be surprised how little land you really need to do something like this. Well, comparatively speaking. You do need a lot of land, but you don't need a farm. You need a couple square feet of land, and then you need a lot of them. They don't need to be close together. You can plant a tomato in less than a square foot of decent soil. You don't need to really own that land either, you just need to have access to it for about ten minutes a day until it's done. When you don't have a job, you can easily find time to cultivate your public garden.
>Such as? What's "reasonably comfortable" to you? Can you provide a simple example?
My personal favorite was an abandoned Jeep Liberty that sat on the side of a highway for about a year and a half. It was for sale, technically, but it had no engine or wheels so nobody would ever buy it. You can use the seats as a cushion if you don't want back pain, or you can just use leaves if you want to.
It's important to to steal or take anything that other people actually own, though. You're trying to unplug, not tear down modern society.
>>

#include <stdio.h>
main(t,_,a)
char
*
a;
{
return!

0<t?
t<3?

main(-79,-13,a+
main(-87,1-_,
main(-86, 0, a+1 )

+a)):

1,
t<_?
main(t+1, _, a )
:3,

main ( -94, -27+t, a )
&&t == 2 ?_
<13 ?

main ( 2, _+1, "%s %d %d\n" )

:9:16:
t<0?
t<-72?
main( _, t,
"@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+,/+#n+,/#;\
#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/+k#;\
q#'r}eKK#}w'r}eKK{nl]'/#;#q#n'){)#}w'){){nl]'/+#n';d}rw' i;# ){nl]!/n{n#'; \
r{#w'r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#\
\
n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; :{nl]'/*{q#'ld;r'}{nlwb!/*de}'c ;;\
{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}+;\
#'rdq#w! nr'/ ') }+}{rl#'{n' ')# }'+}##(!!/")
:
t<-50?
_==*a ?
putchar(31[a]):

main(-65,_,a+1)
:
main((*a == '/') + t, _, a + 1 )
:

0<t?

main ( 2, 2 , "%s")
:*a=='/'||

main(0,

main(-61,*a, "!ek;dc i@bK'(q)-[w]*%n+r3#l,{}:\nuwloca-O;m .vpbks,fxntdCeghiry")

,a+1);}

[\code]
>>
>>51245402
>which makes a potential performance hit not a problem of constants but a problem of your retarded use of the language
I'm sorry long sentences are that difficult to comprehend for you, but try again.
Also, that discussion takes away the attention from your retarded original statement that const values are stored in memory and accessed through dereference, I want to bring that back into attention just to remind you how big of a retard you are
>>
>>51244950
h1 to d5, then d5 to e6
>>
>>51245437
I am sorry if long reply chains are that difficult to comprehend for you but original argument was saying const has no performance it over #define

even if it is retarded, it is a use of language and might cause const to have a performance it. thus const has a potential performance hit comparing to #defines
>>
>>51244950
Trees are perhaps the single most useful data structure by far in CS. Linked list second, sets third, mergefind a distant fourth.
>>
>>51244979
Most scheme dialects, and lisp.
>>
>>51245017
Money is made by being at the right place at the right time, not by making something good or useful, no matter the definition used for those terms.
>>
>>51245478
can't black king move to b7
>>
>>51245059
The performance penalty only happens when you reach beyond the size of a C unsigned long long. I believe they use strings in the backend to implement numbers bigger than that.
>>
>>51245480
no one uses linked lists anon
>>
>>51245522
Good thing computers are awesome at doing math on strings!!!
>>
>>51245522
it should somehow check if it moves beyond long long
>>
>>51245478
>>51245512
yeah, nm, I'm dumb
>>
>>51245298
Except this code still prints 5 on GCC. Since modifying const values is undefined behavior, the compiler can replace all reads of t with 5 as if they were a literal 5. GCC does it even without enabled optimizations, irregardless of whatever you're asking it to do with address of t.
>>
>>51245530
...just convert the string into a 2048-bit int. This isn't rocket science, anon. This is computer science.
>>
>>51245157
You can't remove constness in C.
>>
>>51245479
> const has no performance hit over #define
Which it still doesn't for real-world usage of const. And even if you const_cast and write dynamic values into const you're still not having performance penalties compared to #define, you're just doing something that #define doesn't even support
>>
>>51245542
mine prints 42
>>
>>51245282
>msvc debugger
>even remotely good
>>51245265
stop the memes, use vim and gdb now!
>>
I'm mentally retarded. Could someone explain where I can learn assembly that I could use on Mac OS X?
>>
>>51245400
And so is not using a debugger.
>>
>>51245555
well it's UB, so it prints whatever
>>
>>51245560
You can't program on OS X senpai, only make toys that Apple can then sell for a profit. Install gentoo.
>>
>>51245480

>he unironically uses linked lists.
>not dynamic arrays
>>
>>51245570
my point was it not actual literal like what your compiler compiled. so my const has a performance hit
>>
Could someone explain the const, volatile and register keywords in C?

What's an example of their respective uses?
>>
>>51245478
d5 to d7 actually?
>>
>>51245580
And instead waste 5 hours unrolling the loops in order to use a library or a tool? Windows is the true king of development.
>>
>>51245603
What?
>>
>>51245599
const is just a keyword that won't allow you to change the variable (but it doesn't have any reflection on the actual program), volatile is a garbage keyword that gets ignored oftentimes, register is also useless because the compiler will do the better job than you at deducing which variables are worth keeping in the registers
>>
>>51245598
>const has a performance hit
it doesn't.
>>
>>51245600
black queen takes it
>>
>>51245628
Volatile is fucking essential for multithreading you goddamned pleb.
>>
Programming would be more fun if it weren't for the retarded people ruining it with their garbage. It's even worse when they act overly smug about it and give really shitty explanations for why the terrible choices they made were actually brilliant ideas.

I'm currently rewriting a batch processing program for work. It's making me realize how dumb our data model is. Little to no thought went into our database design. The number of joins necessary to get some very basic data is just stupid. The output file format is like a Walmart shopper shoving everything into their cart. The output ends up being 4x larger than the input data despite containing less information because everything gets duplicated an insane number of times.
>>
>>51245597
I don't count dynamic arrays as a data structure. They're just realloc'd heap memory.

>>51245524
LIsp languages all do as their elementary data structure. They're also used for heaps, queues, stacks, and hashmaps in case of hash collision. They're pretty ubiquitous.
>>
>>51245654
lmfao
>>
hey guys I just learned this code has no performance hit
for(int i=0; i<1000000; i++);

because my compiler optimizes it away!
>>
>>51245659
>programming
>batch
>>>/trash/
>>
>>51245669
Implement an optimized job queue without volatile. I'm waiting.
>>
>>51245599
const simply means the value of something cannot be changed. For example, if a function takes in a const int*, then it's sort of a guarentee that that function won't change the value of the int that's pointed to. It will only look at it and use it's value. It's mostly so you don't do anything stupid, but in some cases compilers can optimize more if they know you won't change a value across a function.
Volatile means that there is no guarentee that the memory remains the same, even if it seems like it should. That probably doesn't make sense, and you should never use this keyword for normal programming. It's ment for very low level stuff, like kernals, to indicate that a variable is, sort of, volatile, meaning it could change without you doing anything. Just pretend it doesn't exist.
And register just means a variable should be stored on the register. This vaguely means something if you're optimising a program, but just ignore this one too
>>
>>51245534
During elementary ops you can have semi-efficient promotion rules (C also needs them anyway). The copy to/from string is going to be expensive though, but that only happens when promotion requires it.
>>
>>51245682
TOP FUCKING KEK
>>
>>51245407
>You don't need to really own that land either, you just need to have access to it for about ten minutes a day until it's done.
If you don't own the land, then the person who does own it isn't going to leave your vegetables there waiting for you when you come back each day, you need the use of the land 100% of the time. The land can't be used for anything else during other times of the day. Also you're going to need a shit ton of land to get 2500 calories a day from fucking vegetables.

>When you don't have a job, you can easily find time to cultivate your public garden.
You basically have to spend all your time doing this though. I can pay for all the food i eat in a day with one hour of work, and I ate pretty well.

>My personal favorite was an abandoned Jeep Liberty that sat on the side of a highway for about a year and a half.
You're going to do all your cooking in there? How are you going to not freeze to death in winter?
>>
>>51245670
Well, it doesn't. Loops aren't executed at compile time, so a loop with no block will never be run.
>>
>>51245692
>I don't know what I'm talking about so I'll just spout memes
>>
>>51245707
that literally sounds like you, you seem to have no idea about mt programming
>>
>>51245667
sorry, forgot to mention that "no person that uses an actual programming language uses them"
>>
>>51245600
>>51245652
h1->d5 forces blacks to move king to c7. if you move d5 -> d7, black king moves to b8
>>
>>51245555
Well the point that it's UB is true, but out of curiosity, what's your compiler? All versions of GCC and Clang seem to give 5 (http://melpon.org/wandbox/permlink/6qFOP7WUKOeDiXnP), even VS did.
>>
>>51245652
C3-B5.
>>
>>51245723
Have you done multithreaded programming in C without any libraries? i.e., with system calls?

Sounds like you're the one who has no idea what they're talking about.
>>
>>51245687
Thanks a lot; that really helped. What about static?
>>
>>51245736
sry it's 2015 gramps, stop being backwards
>>
>>51245729
No because rook.
>>
>>51245670
for(volatile int i = 0; i < 1000000; i++);
>>
>>51245699
>If you don't own the land, then the person who does own it isn't going to leave your vegetables there waiting for you when you come back each day, you need the use of the land 100% of the time. The land can't be used for anything else during other times of the day. Also you're going to need a shit ton of land to get 2500 calories a day from fucking vegetables.
As I said, I don't and can't condone the theft of private property. Public land, such as parks or the small patches of grass between streets and sidewalks, are great for this sort of thing.
>You basically have to spend all your time doing this though. I can pay for all the food i eat in a day with one hour of work, and I ate pretty well.
This isn't really a problem when you consider that days are very, very long and there isn't much to do.
>You're going to do all your cooking in there? How are you going to not freeze to death in winter?
Get a coat. Those clothes drop-off bins are just filled with stuff that people literally threw away. The biggest problem you'll have will be not succumbing to heat stroke in the summer, but there's lakes and oceans for that.
>>
>>51245690
your "elementary ops" are integers operators. anything you put next to them will greatly overwhelm them
>>
>>51245723
He's right you fucking inbred.
>>
>>51245745
>someone else did the work once
>now i don't have to understand how it works
>as long as i know how to call a few functions, i'm a multithreaded master!
>who gives a shit about the implementation
>>
>>51245750
for(volatile register unsigned long long int i = 0; i < 1000000; ++i);
>>
>>51245738
In a source file, file-scope. In a class, instance-independent. An exercise 4u: figure out how to initialize a const static int in a C++ class.
>>
>>51245679
How is that not programming? Do you honestly think every program has a nice GUI and only runs on desktops with a user directly in front of it?
>>
>>51245767
exactly, programming languages are a tool to achieve stuff, idgaf about implementation details, abstract all that nerd bullshit away from me so i dont waste my time
>>
>>51245727
> They're also used for heaps, queues, stacks, and hashmaps in case of hash collision. They're pretty ubiquitous.
Maybe you meant "only people who actually program use them"
>>
>>51245777
Anon, didn't you get the memo? Unless you import javax.Swing.* you're not really programming.
>>
>>51245777
Batch is programming just like "webdev" is programming. You can easily take what you just said and apply it to Javashit.
>>
>>51245786
let me guess, C# or Java developer?
>>
>>51245733
gcc 4.9.2
>>
>>51245758
u wot m8?
>>
>>51245786
>I don't need a good knife, or a good hammer, or a good screwdriver
>Just give me your shitty chinese multitool, it'll get the job done
There's a reason why the best code is hand-crafted, anon.
>>
>>51245800
neither
>>
>>51245738
Static can mean a few things, but it usually means one of these two things.
If you see it in a function, like static int w, then that means w is like a global variable, so it's value is permanent, but you can only access it from inside the function. So if you had a function and you had a static int w inside of it, and you put w++ in that function, then w would increase by 1 every time you ran that function. It's like global, but it's local :^)
It can also be used in front of a function, to indicate that the function is only to be called from within this file. It also has uses in classes, but C doesn't have classes, and in those cases it's pretty much the same as the first use
>>
>>51245733
It has nothing to do with the compiler or version you fucking retard.
>>
>>51245809
more like
>i don't need to be skilled in smithing and be able to forge all the tools
>just let me buy a decent knife from a store
>>
>>51245809
Namely, because code generation sucks.
>>
>>51245753
>Public land, such as parks or the small patches of grass between streets and sidewalks, are great for this sort of thing.
actually it's not. You can't just grow shit on "public land". Public land belongs to the state, and it is generally illegal to use it improperly. Certainly growing things without permission would probably get you a fine. At best it would be torn up by the city council or whatever. Not to mention people fucking up your garden when you're not there.

>This isn't really a problem when you consider that days are very, very long and there isn't much to do.
Subsistence farming is not easy work, and extremely risky. There's a reason most people don't do it.

>This isn't really a problem when you consider that days are very, very long and there isn't much to do.
What happens when you get sick, or injured?

>Get a coat.
Sitting in a coat in your abandoned jeep in a freezing cold, windy rainy night is going to keep you comfortable? Or not dead?
>>
>>51245825
OK, but if someone wants to forge exactly the tools they need, that's fine, isn't it? I'm not saying every programmer should, but being able to build your own tools from first principles is a powerful thing.
>>
>>51245746
? there is no rook in the table

>>51245734
it says two turns
>>
>>51245789
they can't afford not to use them. FP and mutability is so shit, they have to use 20 other data structures just to make their "lists" run at reasonable speed. they still throw cache coherency out of window, add a shit ton overhead while at it.
>>
>>51245855
h1-d5 c3-b5 you fucking retard, 2 turns.
>>
>>51245821
since it's UB it has everything to do with the compiler and its version. Wtf are you on about?
>>
>>51245852
yes true but if we were to compare it to your original point it would have been
>you can't use this knife to slice a bread because you don't know how to forge a knife
Thread replies: 255
Thread images: 16

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.