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

Why is the C programming community so fucking elitist? I can't

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: 240
Thread images: 16

File: C.jpg (9KB, 220x299px) Image search: [Google]
C.jpg
9KB, 220x299px
Why is the C programming community so fucking elitist? I can't get any kind of help or support in IRC or anywhere else without being told I'm fucking stupid for not fully understanding memory management.
>>
>>45994079
Translation: I've been programming C for 3 weeks now and I consider myself to quite an expert, and I asked a really ignorant question with an arrogant tone without even bothering to try to look it up first and got told off in a rude way and that really pisses me off because I expect others to cater me.
>>
>>45994115
Fuck you cunt
>>
>>45994115
Or maybe, just maybe, people are tired of hearing about how "You program in Java? Welllllll C is bettuuuurr" because fuck preferences, I'm right.
>>
>>45994079

There's no way around the fact that C has a steep learning curve, but once you're over it not only will you never need to look up anything about the language itself, but you'll also have a much better understanding of computers in general.

Don't let the IRC folks get you down. Despite them, it's still the best systems programming language for many reasons. The C IRC channels are notorious for being full of the most stuck up pieces of shit to ever disgrace humanity. To them, C isn't a programming language, but a concept of a programming language. You'd never, ever, be able to get anything useful done in C if you tried following the advice on IRC.

The best way to learn C is the old way: come up with something you want to make and look it up in books or on websites, or ask someone IRL. It's been around for too long and, as such, is full of people who think that they're good at it simply because they've been maintaining the same header files for 20 years in their job at IBM.
>>
>>45994287
>C
>steep learning curve
WTF am I reading? C is the simplest and most minimal of all high-level languages today. The standard library is laughably small, the number of keywords and language constructs are minimal, the number of paradigms is highly limited etc.
>>
>>45994079

Guaranteed ways to piss off the faggots on C IRC:

- Talk about modifying a function's return address by taking the address of a parameter and using it to update the stack top

- Assume that an int is 4 bytes

- Assume that a char is 8 bits

- Ask any question about pointers, ever

- Mention that you're actually writing a program in C rather than just meditating on the specification.

>>45994115
You definitely spend plenty of time on C IRC.
>>
File: cat.gif (16KB, 180x236px) Image search: [Google]
cat.gif
16KB, 180x236px
>>45994079
<---- go read it, here's a link: http://it-ebooks.info/book/2265/
And the next time, ask this kind of questions in either >>45980071 or >>45988649.
>>
>>45994334
I agree with you that it's simple once you understand it, but it's nowhere near as easy to get correct as a language like python.
>>
>>45994354
There's a whole fucking book on that? K&R says all you need to know about pointers in a couple pages.
>>
>>45994363
I managed to teach myself C at 11 on my own. It's not hard.

>inb4 you're probably a shit programmer
I work as an embedded dev, have four years of experience and I have a MSc in comp. sci. so I can't be all that bad.
>>
>>45994384
the title is a bit misleading. It should just be called "introduction to C" or some better thing since it covers more than just pointers, but to be honest the only thing to know in C is pointers and memory management...
>>
That's how smart people work. Remember the nerd in high school that would never let you see his homework? But if one of the normal people got the homework they'd let anyone copy it? That's how things work today too
>>
>be java programmer
>fresh outta uni
>meet other guy I know
>he shits on java because bloat or whatever
>don't really care, but listen to what he has to say
>ask him what his preferred language is
>he says c++
>ask him about his experience and what not
>he doesn't know shit

Oh well. I'm learning c++ myself and whatnot so I can get into Qt, but damn some people...
>>
>>45994274
>"You program in Java? Welllllll C is bettuuuurr"
I have a mongoloid in my class group that says this all the fucking time.
"Why they teach us java, is shit , C is better".
He failed a test where the only thing to do was adding two number in Java.
Also , He never programmed in C or C++
Why is people this retarded?
My fav language by far is C and im not this retarted.
>>
>>45994424
I'm not saying it can't be done, just that you can't approach it expecting to be as easy as python or javascript. A good C programmer knows that they're actually controlling a machine, rather than some magic abstract logic brain, and that's unfortunately not how most programming is taught these days. While that's shitty on its own, I think it's a separate problem from the issue that the C community is populated by a ton of elitist assholes (which is completely true). The second problem dissuades people from even trying to learn C, and consequently makes them worse programmers in general.

(Now, if you said you taught yourself C++ at 11, I would certainly have said you were probably a shit programmer)
>>
>>45994540
this
>>
Dude, nobody's going to think you're cool for compiling a C file using GCC on bash.

Learn a modern language like C# instead, learn how to design software, work with databases, client-side development, etc...
>>
>>45994079
C communities are for people solving meaningful, proper problems using C, not pleb tier shit which has been published in hundreds of books for the last 40 fucking years.
>>
>>45994079
How about use Google before asking StackOverflow tier questions?
>>
File: bowser_this_fucking_guy.jpg (91KB, 500x500px) Image search: [Google]
bowser_this_fucking_guy.jpg
91KB, 500x500px
>>45994598
>>
>>45994598
Any guides you recommend?
>>
>>45994424
Is it possible to teach yourself embedded concepts and development to an employable level? Not wanting to go back to school for 4 years to say "yay I have a piece of paper"
>>
>>45994705
>'yay I have a piece of paper'

this is what anti-intellectual liberals actually believe.... kek
>>
>>45994665
Honestly no, just google and a determination to learn.

Keep theory to a minimum, and jump into writing code as early as possible. That's where you really start to learn, and things will actually stick in your head.

That's how you learn!

"I wanna do this with X language, how?"
*think think*
"Okay I'll need to do Y"
"How can I implement it with C#?"
"google"
"oh ok, let's try"
*work work*
"Fuck, there's a weird bug"
*debug debug, google a bit, debug some more*
"It's fixed!"

+1 XP gained. repeat until you reach level 2.
>>
>>45994705
>Is it possible to teach yourself embedded concepts and development to an employable level?
The same skills required for all software developers (data structures, algorithms, discrete maths etc) are required for embedded development as well, so it really depends on how dedicated you are.
>>
>>45994751
I'm not anti-intellectual or liberal though
>>
>>45994774
Any protips or resources for self-teaching? I'm pretty much starting from the floor here.
>>
>not fully understanding memory management

Yeah that's kinda basic kid. Somebody picking on you because you don't understand some obscure standard shit is retarded, but resource management is fucking fundamental.
>>
>>45994348
There are safe assumptions you can make, though. For example, you can assume int is at least 16 bits.

You can also simply use stdint.h. Problem solved in the most portable manner possible.
>>
>>45994348
>Assume that a char is 8 bits

Cool thing about C is that there's a macro called CHAR_BIT defined, which specifies how many bits are in a char. Since char is the basic unit of size and you know how many bits it is, you can calculate how many bits there are in any C object.

>Ask any question about pointers, ever

Why would that piss anyone off
>>
>>45994348
>modifying a function's return address

What practical reason is there to do this?
>>
>>45995058
Malware
>>
the people in ##c on freenode enjoy toying with noobs (Zhivago, kate, chris, etc). you will actually learn something from them, they will just make you guess every step of the way by asking you questions on how everything is implemented
>>
>>45994886
Get a copy of K&R C version 2, start using linux, figure out a simple project you want to try in C. It's like most programming languages that way.

>>45994949
>>45994965
I know that there are proper ways to do those things, and I know they aren't good practices. I was simply stating that they're a great way to get C purists upset with you. That's why asking about pointers is going to piss everyone off: they think that C is god's gift to man and you are blaspheming god if you don't understand his holy language after a single reading of the old testament (the C spec) and the new testament (K&R).
>>
>>45995378
Actually, all of them will tell you nothing except for "C probably isn't for you" and "learn to fucking google, moron", and then proceed to suck each other's dicks and then ban you if you mention that they aren't following the channel guidelines of "being respectful".
>>
>>45995378
Weren't those ##c people also responsible for Zed Shadow's ebin meltdown?

>>45995434
So they get mad because someone doesn't understand something? What

Why even hang out in the channel
>>
>>45994079
That's hilarious. C programmers are probably the worst language assholes here too.
>>
>>45995473
> So they get mad because someone doesn't understand something?

That's exactly it. Well, maybe they aren't actually angry (hard to tell when all you have is text), but they certainly take the smallest misunderstanding as infinite license to be absolute cunts.

>>45995485
It's true, but unfortunate because C really is a great language and is really quite simple for all of the amazing things that have been created with it.
>>
>>45995434
K&R C ver. 2, got it. Did a few exercises out of it, it is a bit over my head right now. I love the tone of the writing, but it doesn't seem to be a tutorial but more of reference for people with prior experience. Currently reading Python Programming-An Introduction to Computer Science 2nd edition by Zelle. Like I said starting from the floor. Linux, got it. Baby 12.04 and a copy of The Linux Command Line by Shotts. Never thought I would get enjoyment out of looking at a terminal. Just went crazy downloading a bunch of books, like Discrete Math 4e by Epp, and Computer Organization 4e by Shiva.

Its nice to open up Epp and think to myself, "Hey this shit kinda makes sense" after I failed the living hell out of PreCalc. Yes, PreCalc.
>>
>>45995459
If you talk back to your superiors and call them abusive for trying to teach you how to fish, you're a spineless piece of shit and you don't belong on the business end of a keyboard. Programming is about patience, suffering, and brute force. It's hard work, not a game where you can pay to win and cheat your way to the top.
>>
>>45994079
never go to freenode ##c it's shit
Seriously, I went in just once and in less than an hour a guy asks for help while telling everybody to go fuck themselves, someone falls for the bait and they argue endlessly, while I, trying to answer his question, get completely ignored. Then the faggot gets muted and starts querying everybody fuck knows what for.
A while later I ask about open() and they condescendently say nobody knows shit about open() because it's not in the standard.
>>
>>45995669
>your superiors

lmao
>>
>>45995678
People can see when I query/info/whatever them?
>>
>>45995655
downloading single books?
here's the must have for staying on /g/

>books.gentoomen.org
>>
why do you even study C? there was a time when it made sense as introductory, but not anymore.
if you intend to develop system software/low-level stuff then you also should be studying computer architecture, os internals, etc.
>>
>>45995692
I think he used "query" to mean "private message"
>>
>>45995669
The thing is, they're not trying to teach you to fish. Instead they believe that fishing is deprecated as fishing isn't a part of the wakeboarder's handbook and they'll condescendingly mock you for wanting to learn to fish.
>>
>>45995739
This. This is the fucking C community in a nutshell.
>>
>>45995702
Holy shit.
>>
>>45995655
Sounds like you're doing the right thing, already, then. There are plenty of online C tutorials out there if you just google for them, which will almost all be slower than K&R. Given your current level of (not very much) experience, this may be more the thing to do until they get boring. Then try going back to K&R.

>>45995721
I agree that studying C as a language alone is kind of worthless and needs to be motivated by a desire to interact with lower levels of programming. Even so, I think a beginner can start at either end of this.
>>
>>45995764
You must be new here.
>>
File: imNewIDontKnowWhatImDoing.jpg (108KB, 478x359px) Image search: [Google]
imNewIDontKnowWhatImDoing.jpg
108KB, 478x359px
>>45995823
Yup.
>>
>>45995892
The umbilical cord reminds me of rubber balloons.
>>
>>45995920
They make them out of rubber.
>>
File: 1420594493952.png (58KB, 647x474px) Image search: [Google]
1420594493952.png
58KB, 647x474px
>>45994598
fucking normalfag casualfag millennials
>>
File: 1419206161985.gif (1015KB, 500x470px) Image search: [Google]
1419206161985.gif
1015KB, 500x470px
>>45994079
C is easy peasy nigger.
C programmers are fucking pissed off because literally every girly ass python-writing college student retard fuck in the whole damn world can't stop sperging on about how C is inferior, while not understanding the first thing about C, compilers, kernels, drivers, or computers in general.
Every person who doesn't know C has at least had the autism to invent some preconceived notion about the people who use it (sounds kind of like the amerifat meme ;^) ).
http://research.microsoft.com/en-us/people/mickens/thenightwatch.pdf
>>
>>45996429
I rarely hear people say that C is inferior, except in very specific cases, or by C++ users
>>
File: 1420002861814.jpg (48KB, 531x531px) Image search: [Google]
1420002861814.jpg
48KB, 531x531px
>>45996429
ppppsssssssssssssssss

*whishpers*C++ is greater and you know it
>>
>>45996498
Uh, you're the one who started shitposting at someone who actually posted some content just because you saw some anime.
>>
>>45996577
I wasn't shitposting. They were going off about how the C assholes dindu nuffin and he had the stereotypical smug anime face.
I was merely directing him to a board that would probably suit him better.
>>
I know C++, but I have no idea how you would even structure a program in C.
Do you seriously Just have a ton of public structs and functions that are always visible to anyone and you hope that nobody ever calls them because you implementation might change?

How do you even live without containers and their algorithms? How do you make something like remove_if without functors and lambdas?
I like languages where you have many techniques at your disposal and C doesn't have that.
>>
>>45996609
> you hope that nobody ever calls them because you implementation might change?

typical OOP fag
>>
>>45994287
>C
>best systems programming language
top kek, anon
>>
>>45994079
>asking random people in internet forums and chat channels for help with something
That's your first mistake. Doesn't matter what the subject is, that's about the response you're going to get.
>>
>>45996629
So that IS how you do it.
What a horrible language.
>>
>>45994079
>I can't get any kind of help or support
>I can't get any support for the most popular programming language in the world
I'm sure.

>>45994115
Probably this.

>>45994334
This.
>>
>>45994079
>##c
>in freenode
they are all a bunch of assholes, yes.
>>
>saying C is easy
If you don't give a fuck about memory leaks, sure
>>
>>45996785
You forgot about the segfaults.
>>
>>45996609
One way:
// foo.h
struct _Foo;
typedef struct _Foo Foo_t;

Foo_t Foo_Create();
void Foo_Destroy(Foo_t* foo);
int Foo_Do_Something(Foo_t* foo, int bar);


// foo.c
#include "foo.h"

struct _Foo
{
int data;
float stuff;
};

Foo_t Foo_Create()
{
Foo_t* f = malloc(sizeof(Foo_t));
f->data = 0;
f->stuff = 42.0f;
}

void Foo_Destroy(Foo_t* foo)
{
// destruct stuff here
free(foo);
}

int Foo_Do_Something(Foo_t* foo, int bar)
{
foo->data = bar;
return 69;
}


That way the contents of Foo are never seen by the user of it.
>>
>>45996604
I don't think /a/ would bitch as much about C as you do about anime.
It's surreal.
>>
>>45996827
Only one way to find out. I'm sure they pretend to program at /a/ every now and then.
>>
>>45996815
>typedef struct _Foo Foo_t;

stop
>>
>>45996609
>>45996698
static void hi()
{
printf ("Dear C++ programmer, my name is Hi and I am a static function. The static keyword means that I am not visible to the linker and therefore cannot be called from outside of the current file. You might be surprised, but I also exist in C++, so you should probably already know me!");
}
>>
>>45996815
Ah, I had no idea that this worked. I thought you had to declare the contents of a struct the moment you declare it.

That still seems to me like a lot of boilerplate to recreate what can be done much easier with a struct / class in C++ with private members.
>>
>>45996873
There's no need to use those in C++. We have better tools to hide functions and data.
>>
>>45996874
C is ALL ABOUT pointless boilerplate and mysterious segfaults.
>>
>>45996914
That's no reason not to know how your language works.
>>
>>45996914
>>45996874
> better tools to hide functions and data
Yes, C++ has a much better tools to shoot yourself in the foot. At least you have honesty to actually call it hiding and not abstraction.
>>
File: 140068965535.jpg (39KB, 720x479px) Image search: [Google]
140068965535.jpg
39KB, 720x479px
>>45996851
Oh wow man you're such a fucking expert programmar damn no foolin around right down2business hardcour motherfucker right here academic research n shit pragmatic thinker intellectual entrepreneur SOUND CODING PRACTICES keep it simple modular BIG OH no god-objects don't reuse code recursion eval/apply problem domain bottom-up tree graph towers of hanoi the cat ate my source code Qui caedebant saxa et nos semper oportet esse mere envisioning cathedrales fucking expert godprogrammer amirite.
>>
>>45997149
Whatever you say man.
>>
>>45996661
Then what's better? What language can interact with actual hardware, running in ring 0 (or whatever your processor of choice calls privileged mode)? Your only 2 choices are C and C++, with C++ requiring much more runtime support in order to use the non-C features.
>>
>>45996874
It's really not that bad. Instead of
class What {
int WhatMethod() {...}
};


You just do
typedef struct {...} What;
int WhatMethod(What *w);
>>
>>45996914
>There's no need to use those in C++. We have better tools to hide functions and data.
Nope, it's done the same way in C++.
(Well there's anonymous namespace, but it's effectively the same thing)
>>
>>45996874
C++ has just as much boilerplate in the implementation, it just has slightly more convenient syntax for the user code.
>>
>>45994935
But but feminism said we dont need patriarchal management schemes anymore
>>
>>45997170
>only 2 choices are C and C++
>he doesn't know about Ada
lel

Seriously, C hasn't been the top systems language since about the mid 90s when Ada got a free software compiler.
>>
>>45997259
>Ada
lol
>>
>>45997170
Rust
>>
>>45996609
>Do you seriously Just have a ton of public structs and functions that are always visible to anyone and you hope that nobody ever calls them because you implementation might change?

Most C programmers can take care of this, at least partially, by limiting "public" structs and functions to header files (that is, the headers are APIs and not details), and keeping implementation-only function definitions in the implementation files. Also, large C projects (such as SDL) often do a hackish namespacing by prefixing their struct/function names with something consistent. It's kind of ugly, but not much worse than
std::vector<mynamespace::DataType> mynamespace::MyFunction(mynamespace::InputType input) {...}
>>
>>45997306
Sorry anon, immature languages that haven't standardised yet aren't in the running.
>>
>>45997314
C++ would be much easier to read if people just used
using namespace
, as the language creator intended.
But no, muh possible namespace collision that never actually happens in practice!
>>
>>45997358
I agree, but sadly too many people will jump down your throat for something as simple as
using namespace std;
>>
>>45997358
Also,
>muh possible namespace collision that never actually happens in practice!
has been my experience with C, too.
>>
>>45997370
Not using it in headers is a no brainer. Nobody would want to unknowingly import namespaces by just including a header file.
But in your implementation, I think that it's totally fine.
The projects that I'm working on don't do it, so I learned not to do it either. But I swear I would only type 70% of the text I have to now if I could just import the namespaces.
And don't even get me started on how much more readable this would make the code without namespace names and double colons everywhere.
>>
>>45997390
It did happen or it didn't happen?
>>
>>45997457
I have never had problems with namespace collision in C, and I use it frequently. Descriptive function names are very helpful.
>>
>>45997489
Yeah. Considering that C only has 1 namespace, that's really impressive.
Why would you not use the std:: namespace in C++? If some library was stupid enough to use a class name or function that's already in the std:: namespace, you should tell them to go fuck themselves.

On that note: Fuck you, Boost. And you too, Qt.
I'm starting to think that it would be better if C++ didn't have namespaces, just like C. Then people who write libraries would be forced to use descriptive names.
>>
>>45994079

git gud

op it's because C has been around for so long and it's used for so many things you're probably talking to dudes in their 50s and 60s
>>
>>45997526
C++ has plenty of useful features, sadly simplicity and terseness are not on the list.
>>
File: absolutelydisgusting.jpg (77KB, 384x512px) Image search: [Google]
absolutelydisgusting.jpg
77KB, 384x512px
>noob asks noob question
>gets called out for it
>cries
>paints the whole community
>shitposts on /g/

it's your fault for not learning the language from a book and using irc to ask intelligent question, fucker. i bet you asked what malloc() does
>>
>>45997564
It would have those if C++ developers were using it properly.
Sadly, there's more to a language than the possibilities it offers - conventions develop and ruin a great and usable language.
It could be worse, though. I heard cobol developers are, by convention, not allowed to use any magic numbers whatsoever - if you want to add 1 to a number in a loop, you actually need to define a constant called "one" somewhere.
>>
>>45997595
Typical C programmer, blaming the victim.
>>
>>45994334
you have no idea what you are talking about
do you even know what strict aliasing is?
>>
>>45996609
>>45996698
Your problem is that you don't understand what the compiler actually does, and why the linker runs as a separate phase of the build process. Your program relies on libraries which are already compiled and assembled into machine code. Your program also has to be assembled into machine code (as an object file, .o) before it can be merged together with the library code. As a C++ user you're used to thinking of this as happening in the front end, before optimization. But actually, it's redundant to do it that early, because linking still has to happen at the end.
>>
>>45996914
No you dont: private functions are shit. You make function private and you think it is "hidden"? It is not, it is still visible outside on translation unit. And you know what that means? It means compiler cannot apply basic optimizations, like it cannot inline large function which is called only 1 time because compiler cannot know if this function is called from another translation unit. With static functions (and anonymous namespaces) it is guaranteed that function is not visible outside of translation unit, it is perfectly encapsulated. On the other hand, because those are not class "method", they have no access to private field of your class, so you are forced to use member functions and get worse performance and broken encasulation.

All this because C++ has no modules, instead it has "friend" functions and classes, but those are very limited. If C++ would be better designed and had no C legacy, you would create a module and everything would "public" internally, but incapsulated for external users, like normal langauges do
>>
>>45997782
I find it heartbreaking that GCC finally broke down and builds its C compiler using C++ now.
>>
>>45996815
fuck off i-always-typedef-my-structs faggot

>>45996874
If you need to retain binary compatibility between different version of your library, you are forced to use the same pattern in C++. Also you cannot use templates because of this

>>45997782
also: that means that making functions "private" in C++ DOES cost you performance because compilers a fucken horrible. So much for "you do not pay for what you do not use"
>>
>>45997659
we're not your personal tutor. if you don't put effort into your learning, you're not worthy of our time and effort
>>
>>45997926
>Hey guys, I have a question.
>Can you tell me about this poorly defined or otherwise arcane property of C?
>Fuck off, we're circlejerking. This is so readily apparent to those of us who spend our lives only using C, the greatest language to ever exist.
Sure.
>>
File: b006.jpg (128KB, 844x1057px) Image search: [Google]
b006.jpg
128KB, 844x1057px
>>45996429
underrated link to PDF, that M$ villian is based, most based melanin-enriched individual I have read in forever
>>
>>45997926
>You don't want to put time and effort into answering a question that should be easy for you, so you instead put time and effort into insulting someone for wanting to learn the language you know

C is literally the only language with users who *don't* want everyone else to adopt their language of choice.
>>
>>45994334
>C
>high-level language
>>
>>45997782
>It means compiler cannot apply basic optimizations, like it cannot inline large function which is called only 1 time because compiler cannot know if this function is called from another translation unit.
Why would that prevent inlining?
Whether something has internal or external linkage or how many times a function is called has absolutely no impact on the ability to inline something.
The only thing that's required is that the compiler has access to the definition of the function.
>>
>>45994079
Filthy casual
>>
>>45998001
To people who are good at C, C is definitely a high level language. To be good at C, you need to understand how computers work and all the things the language is doing for you. After writing a bootloader in assembly and jumping to a C kernel, C will seem like a very high level language indeed.
>>
>>45998020
The visibility does make a difference, because if it's visible to the *linker* it can't be inlined, at least not in the other binary objects that use it. If it's declared as static, the compiler can know for sure that it will never be used in any other library.
>>
>>45998020
>Why would that prevent inlining?
Because function is large and compiler assumes this function maybe called from somewhere else (because it may actually be called, it is not really "private"), so inlining will create code code => cache pollution => slower code execution. Compiler does not know that functions is only called once in all program. Because he does not see whole program, only 1 file. Modern compilers can do whole program optimizations, link time code generation etc, but they still suck and still fail to inline such functions

>The only thing that's required is that the compiler has access to the definition of the function.
And modern compiler with link time code generation might get definition from object file directly, so placing functions in headers is not necessary.
>>
>>45998062
>C is definitely a high level language
>you need to understand how computers work and all the things the language is doing for you
So it's a high level language except it isn't? Make up your mind.
>>
>>45997782
What the fuck are you on about?
Functions external visibility has ZERO impact on ability to inline.
And non-member functions shouldn't touch private data in the first place, so that's a non-issue. But even if you do have non-member functions needing to do that it's obviously trivial to inline accessor methods.
>>
>>45994079
Filthy casual
>>
>>45998034
>>45998142
Agreed. Only casuals and corporate drones use C.
>>
>>45998165
What you just said is very dumb
>>
>>45998126
Reread what I wrote. Function external visibility HAS impact on compilers decisions. "static" function o function in anonymous namespace which is called from 1 place in a file will always be inlined, regardless of its size, but if it is external, it maybe called from somewhere else, so compiler avoid inlining large functions to prevent possible code bloat if it is actually called from somewhere else
>>
>>45998109
C is certainly a high level language. It's about as high level as you can get without going pants-on-head dickbees. It's hugely expressive compared to assembly. It has infix operators that you can nest in arbitrarily deep expressions. It has language support for dynamic allocation and recursion, using local variables the stack. It has local static variables (one-time per-process allocation). It has function pointers. It has an expressive preprocessor that lets you extend the language in arbitrary ways.
>>
>>45998099
>The visibility does make a difference
No, it doesn't.
Linkage is purely a linker thing (as the name suggests), whether the final executable will have those symbols publicly exported or not.
>because if it's visible to the *linker* it can't be inlined
Nope, completely irrelevant.
Compiler can (and will) do independent inline decisions at each call site - it might inline some, it might generate a function call at others.

>>45998101
>Because function is large
Why would you wanna inline a large function?
>compiler assumes this function maybe called from somewhere else
Again, this is completely irrelevant.
What matters is the current call site - it knows the function is X bytes large, it will potentially be inserted at call site Y, does it make sense or not? This decision is completely independent whether X is called a billion times somewhere else.
Remember, C++ (and C) operate on a translation unit by translation unit basis.
If you wanna talk about global optimizations then it still doesn't matter because now it actually does know how many times it's called.
>>
>>45998227
>this is what Cfags actually believe
Stay pleb anon.
>>
File: 1408077362980.png (877KB, 900x1346px) Image search: [Google]
1408077362980.png
877KB, 900x1346px
>>45998165
I hope you leave the genepool
>>
>>45998227
>C is certainly a high level language. It's about as high level as you can get without going pants-on-head dickbees.
Sure it is.
>It's hugely expressive compared to assembly.
No argument there.
>It has infix operators that you can nest in arbitrarily deep expressions.
>infix
>It has language support for dynamic allocation and recursion, using local variables the stack.
Yet no support for infinite recursion with TCO, huh?
>It has local static variables (one-time per-process allocation). It has function pointers.
Function pointers aren't a replacement for first class functions.
>It has an expressive preprocessor that lets you extend the language in arbitrary ways.
Oh please. The preprocessor is shit. Have fun manipulating text and escaping newlines to give the illusions of macros that can be more than one line long.
>>
>>45998205
I suppose I forgot the masochists and those who must work with really old preexisting codebases.
>>
>>45998258
>being this mad about your outdated segfault language
>>
>>45998237
>Why would you wanna inline a large function?
Because if function is called once, inlining it will give you performance regardless of its size. Also sometimes function may be large, but it doesn't mean it executes alot of time, it may check some flags and exit immediately most of the time. Calling it and returning might cost you few % of performance.

>What matters is the current call site - it knows the function is X bytes large, it will potentially be inserted at call site Y, does it make sense or not? This decision is completely independent whether X is called a billion times somewhere else.
If function is called many times and its is not trivial, compiler will avoid inlining it to avoid code bloat and cpu cache pollution which may lead to even worse performance.

>If you wanna talk about global optimizations then it still doesn't matter because now it actually does know how many times it's called.
Doesn't look like modern compilers check that. If you would look at the assembly generated by your compiler, you would see.

You have no idea what you are talking about. Here is example for you. I am using gcc 4.9.2:
#include <stdio.h>

void foo(void)
{
printf("One\n");
printf("Two\n");
printf("Three\n");
}

int main(void)
{
foo();
return 0;
}


Compiling with gcc -O2 give following code for main() function:
sub    $0x8,%rsp
callq 400520 <foo>
xor %eax,%eax
add $0x8,%rsp
retq


adding "static" to "foo" function changes this to:
sub    $0x8,%rsp
mov $0x4005c4,%edi
callq 4003e0 <puts@plt>
mov $0x4005c8,%edi
callq 4003e0 <puts@plt>
mov $0x4005cc,%edi
callq 4003e0 <puts@plt>
xor %eax,%eax
add $0x8,%rsp
retq


using "gcc -O2 -flto" fixes this, but it doesn't work always
>>
>>45998260
>Yet no support for infinite recursion with TCO, huh?
That's up to the compiler. Most of them implement this.
>Function pointers aren't a replacement for first class functions.
First class functions only make sense in a garbage collected interpreted language. But anything you would use them for can be done with normal function pointers anyway.
>>
File: 1419863165150.jpg (433KB, 852x973px) Image search: [Google]
1419863165150.jpg
433KB, 852x973px
>>45998309
Ritchie was the man you could never dream to be, you horribly deranged faggot
>>
>>45994115

Nah, CS majors do generally seem like cunts.

I've met premed and engineering and mathematics majors that are perfectly well adjusted even though they invest as much time and skill as their CS counterparts.

Yet for some reason only CS tend to feel like they're uniquely privy to forbidden knowledge or something.
>>
>>45998387
>That's up to the compiler. Most of them implement this.
It's not portable.
>First class functions only make sense in a garbage collected interpreted language. But anything you would use them for can be done with normal function pointers anyway.
On that note, does C even have anonymous functions?
That's one advantage of having a function type, since it doesn't have to be bound to an identifier to be referenced.
>>
>>45998309
Once you get good, you rarely get segfaults and they're easy to debug with gdb or a couple printf's.

Also, do you know why the interpreter of your chosen high level language sometimes segfaults? Its because your language of choice was, and continues to be, written in C itself.
>>
>>45998370
Finally somebody who knows what he's doing around here. Of course, that particular example could be chalked up to gcc being kinda shitty.
>>
>coming to /g/ to avoid elitism
>>
File: 000000000762[1].jpg (8KB, 214x300px) Image search: [Google]
000000000762[1].jpg
8KB, 214x300px
>>45998395
Ritchie pls

>>45998434
>implying all high level languages are implemented in C
>implying runtime errors are better than compile time errors
I will note that literally the only time I've ever had Haskell segfault is when I specifically made it do so with an unsafe coerce. Not that Haskell is in the same niche as C, C++, Ada, of course.
>>
>>45998515
C also has way fewer runtime errors than most interpreted languages. Of course, not much at all can compete with Haskell on that front, so I won't argue with you there. Also, haskell's compiler may be bootstrapped now, but this isn't particularly common even among compiled languages.
>>
>>45998565
>C also has way fewer runtime errors than most interpreted languages.
I guess if you don't count array bound violation as an error, then you're right.
What a smart way to get rid of your problems. Just call them features!
>>
>>45998565
Before you get too far along that sidetrack (sorry), the language of choice that I prefer over C is Ada. While Haskell is great, it can't do the same level of efficiency and resource predictability, which is needed sometimes. Pic in my previous post was Jean Ichbiah, the inventor of Ada.
>>
>>45994886
Some things to take a look at:
"Computer Organization and Design - The Hardware-Software Interface"
MSP430 Launchboard for a cheap learning microcontroller.
Mojo for a cheap FPGA.
Google around.
>>
>>45998370
It's always trivial to find number of call sites - it's a fricking simple hashmap of calls["function-name"] -> int
It's the same kind of optimization which eliminates unused functions.

Also
>using gcc

clang gets that right even at -Os
>>
>>45998589
Array bound "violations" not only often cause obvious errors, but memory "unsafety" could indeed be described as a useful feature of C. Good luck implementing hardware paging support or memory mapped I/O drivers in a language with strict bounds checking.
>>
>>45998648
>It's always trivial to find number of call sites - it's a fricking simple hashmap of calls["function-name"] -> int
And compilers often refuse to do this. Probably it is not simple as it sound, since to know how many times functions was called, you need to know haw many times it was inlined instead of a call, and to do this you need to optimize whole program code so you could optimize it even more. It is not the same as unused function.

>clang gets that right even at -Os
clang is even better at this because it always inlines static functions that are called once. For some reason gcc refuses to do inlining in some cases. I don't know what stops him, but I saw this few times.
>>
I dont mean to hijack the thread or anything guys....

But I need some recommendations on this.

Do I need to read a book or anything on learning how to use Linux and all those complicated distros you guys use like Gentoo and Arch?

I am going to learn Assembly and some anons told me to move to Linux and use assembly there.
>>
>>45998750
>Array bound "violations" not only often cause obvious errors, but memory "unsafety" could indeed be described as a useful feature of C.
>memory "unsafety" could indeed be described as a useful feature of C.
>Putting "unsafety" in quotes like it isn't unsafe.
>Calling memory unsafety a useful feature.
Jesus Christ. C fags everyone.
>Good luck implementing hardware paging support or memory mapped I/O drivers in a language with strict bounds checking.
Operating systems have been implemented in languages other than C you know. Operating systems still use assembler for the things they really need to anyways.
Even then, it's nice to know you're an operating system developer and can justify using C. What's it like, doing that?
I assume you must make use of those features if they're the only defense of the language you've given.
>>
>>45997259
Doen't Ada cost out the ass if you want all the stuff that could be considered "superior"?
>>
>>45998370
Private functions ARE handled specially because the compiler knows no one outside the class can call them.
class foo {
void _bar();
public:
void bar();
};

void foo::_bar()
{
puts("one");
puts("two");
puts("three");
}

void foo::bar()
{
puts("1");
_bar();
puts("2");
_bar();
puts("3");
_bar();
}

int main()
{
foo f;
f.bar();
}


_bar() is inlined no problem into bar()
but bar() is not inlined into main()
>>
>>45996815
Your
Foo_Create()
function isn't returning anything, eh?
>>
>>45998807
Nope. All the static checking you get for free. Ada loves trying to catch all the errors it can at compile time. The runtime checking is a 20-50% performance penalty compared to unsafe C code, which is still pretty damn fast.
>>
>>45998778
What kind if assembly? x86? Any assembly?
If any assembly is ok, then you should find some MIPS simulator with debugging support and CPU pipeline visualization. You will not only learn assembly, but you will be able to understand how real CPU executes those instructions.

I cannot recomment any specific simulator, but I heard about MARS MIPS simulator. You can start here. I don't know if it is good
>>
>>45998802
>I assume you must make use of those features if they're the only defense of the language you've given.

Absolutely, and I love it.

Also, no sane person would implement paging or memory mapped I/O in assembly. Plus, any OS that does such things in a language other than C needs to disable or bypass the language's safety features in order to do so.
>>
>>45998819
There are also friend classes. In this case private function can still be called from outside. And don't tell me that friend classes are evil. You cannot write non-trivial program without them since C++ cannot into modules
>>
>>45998778
x86 assembly on Linux is a great way to start. Just google "Linux assembly hello world" and you'll fins tons of stuff to get you started.
>>
>>45998861

I have no idea what you mean when you ask me what kind of assembly.

I just found this book on the internet called ''Programming from the Ground Up'' which, according to google, is a good book to learn Assembly. I know little about it and I have no idea what I am getting into, so some anon just told me ''lol install gentoo or other distro anon''.

Since I have never used Linux (win all my life) then I figured it would be a good idea to read this Assembly book along with something that also teaches me Linux and how to use the more complicated distros like Arch and Gentoo etc etc
>>
>>45998867
>Absolutely, and I love it.
Which os do you develop?
>Also, no sane person would implement paging or memory mapped I/O in assembly. Plus, any OS that does such things in a language other than C needs to disable or bypass the language's safety features in order to do so.
Not true. It could be done in hardware or the language could be developed in itself and implement its own GC and other facilities.
>>
>>45994079
Maybe you should stop being fucking stupid and better understand memory management.
>>
>>45998900
>Programming from the Ground Up
I'm going to start reading that one soon. It looks promising.
>>
>>45998767
>since to know how many times functions was called, you need to know haw many times it was inlined instead of a call,
The compiler obviously knows when it has or hasn't inlined something.
Hell you can just grep for the function address in the binary and you get the number of direct call sites - you'll miss indirect ones through registers or pointers, but those ones couldn't possibly be inlined anyway, so they shouldn't really be counted unless you're optimizing for size)
>>
>>45998880
>You cannot write non-trivial program without them
Of course you can.
friend classes or functions are always a sign of a bad design.
Either you do stick to encapsulated classes or you don't, it's retarded to mix the two. If you do intend to manipulate data members from a variate of free functions then make it a simple struct.
>>
>>45994598
b8
>>
>>45998900
Every processor has its own set of instructions. Intel processor use different instruction than MIPS or ARM processor. Assembly is a human readable representation on those instructions. Since instructions are different for different processors, assembly will also be different.

Starting with Intel assembly might be easier, because it is easier to find books etc, but you will just learn assembly, nothing more. With good simulator you can learn much more. I recommend MIPS simulator and MIPS assembly because for some reason that what people usually use to learn how processor works. Good simulator will help you to understand processor internals better, you will be able to learn about pipeline, pipeline stalls, fast data forwarding and parallel execution. Also MIPS assembler is simpler that x86. But you really need to find good simulator here.

After learning MIPS, learning assembly of Intel processor will be easier
>>
>>45998853
Ada's free toolchain is a joke.
Which is also why it has never caught on.
>>
>>45998993

Ok ok so far I get that

- I need to use a simulator
- Intels assembly is easier

Ok... so I get the simulator. Then why did the other anon suggested Linux again?
>>
>>45999020
GCC is a joke?
>>
>>45999020
gnat is generally the top performing Ada implementation.
>>
>>45998927
>The compiler obviously knows when it has or hasn't inlined something.
Not it does not. To know this compiler will need to perform optimization. If you use whole program optimization, that will mean compiler will need to recompiler program 2 times: 1st time to find how many calls worth inlining, 2nd time to generate more efficiet code using this knowledge. My assumption that it gives little benefit, but increases compilation time, so no one cares. All who cares just use __forceinline, __attribute__((always_inline)) etc.

>>45998987
Then you have never written anything performance critical. Some things should be hidden from user, but class internals should be accessible to other classes for maximum performance. EVERY language with OOP support today has and actively uses equivalent of "friend" classes and functions: Java has packaged, .Net has modules and internal visibility. This is called "modular programming". Like Object-Orientet programming, just Modular. And its been like this since forever. Because you just cannot do anything non-trivial without this. After all, there is a reason why data structures and functions are callected into module: because they cannot be separated.
>>
>>45998062
>To be good at C, you need to understand how computers work and all the things the language is doing for you.

This is false. I don't know how computer's work but I am good at C. This is in essense why it is a high level language.
>>
>>45999023
A simulator is a good way to learn what assembly does in general, but if you want to write real programs, and are using a modern laptop or desktop, look up tutorials for Linux x86 assembly.

>>45998906
I do systems security work, and work on some experimental small OS kernels, hypervisors and Linux modifications to that end.
>>
>>45999023
>- Intels assembly is easier
No, it is just books are easier to find and more people are familiar with it. MIPS is simpler.

>Then why did the other anon suggested Linux again?
Because he is a gigantic faggot. If you need to learn assembly, you shouldn't case about OS. OS will actually make everything harder, because if you want to output a string, you will need to also learn OS specfic APIs to do so. With simulator it is easier, because they usually provide trivial way to print a string to simulator console specifically to make it easier for students
>>
>>45995892
I can't believe I noticed this, but isn't that ballsack too big?
>>
>>45999094

I see. Well I would like to write programs in general, atm I am learning python but would like to move to other stuff of course.

I would like to learn Assembly to learn more about programming hoping that my learning will become more straightfoward and easier if I know the basics.

So Linux is a good enviroment for that?
>>
>>45999078
C is a low level language you fuck
>>
>>45999094
>I do systems security work, and work on some experimental small OS kernels, hypervisors and Linux modifications to that end.
Cool. I guess your use of C is justified in those cases.
I can't stand the faggots that use it for everything they do though.
>>
>>45999129
Unless you want to do systems work, there is such a thing as too low level. You sound like you need to study algorithms and their complexity more.
>>
>>45999129
As I already said, if you want to write "real" programs, you should use high level language, not assembly. If you want to learn more about processors - then you should use simulator with pipeline visualization.
>>
>>45999050
>gnat is generally the top performing Ada implementation.
Yes and you might note there's both a Free and a Pro version. (and the high-safety and high-security features costs extra)
The actually good Pro version will rape your wallet twice over.
>>
>>45994079
Take it easy man, it is just that you don't know about memory management
>>
>>45999141
Thanks for understanding. I also like plenty of other languages for side projects, but will defend C against the tyranny of all those who say I shouldn't be able to do the things I find it useful for.
>>
>>45999072
>Then you have never written anything performance critical.
>Some things should be hidden from user, but class internals should be accessible to other classes for maximum performance.
Performance critical code generally avoids OOP style all together.
It's all about arrays of data that you batch process on.
// bad for performance
for c in collection:
c.perform(); // updated in isolation, no hope to use things like streaming instructions

// good, now we can unroll the loop, fit things into vector registers, etc
perform(collection, N)


My main area of interest is low level optimizations in regards to image and graphics processing, I write a lot of assembly code and C/C++ code using intrinsics.
>>
>>45994755
Yep, basically this
>>
>>45997436
I am okay with namespaces when it is one or twice. But when you use a data type with a long prefix and use it inside a template it becomes unreadable and this is where you use namespaces.
>>
>>45999202
You're welcome. Like I said, I just can't stand the people that don't use it for the one thing it's arguably good for.
There's too many people that say to use C for everything, like bittorent clients and other crap.
>>
>>45999072
>that will mean compiler will need to recompiler program 2 times:
The compiler does several passes precisely because of this, so it can inline "up the chain" and once it has inlined perform other optimizations like more constant folding and rearrange register usage.
>>
>>45999207
I've heard a couple guys saying on the freenode assembly channel (which is much better than ##c, btw) how much of a myth it is that compilers optimize better than a human programmer can in assembly. Would you agree with this?
>>
>>45999207
Encapsulation != OOP. Years before OOP existed it was called modular programming. Encapsulation itself does not affect performance. Unless you are writing in C++.

>>45999244
Thats what I wrote. If it affects compilation speed and gives little benefit, then compilers might avoid doing so.
>>
>>45999171
gnat is GPL
gnat pro is just a bunch of ide, debugger, profiler, test framework, etc type stuff around it, it uses the exact same back end code generator - namely gcc.
>>
>>45999171
The difference between Free and Pro versions is a matter of being up to a year out of date. Aside from the obvious licensing and support differences, I mean.
>>
>>45997659
Or just getting pissed at someone asking a question that has been answered before and is easily researched. I'm a fucking noob here (the guy that posted >>45995655) and have the presence of mind to know that there are some things you don't ask. If the answer can be found in a book or exercising your google-fu then how can you expect a polite answer in a gathering where anonymity busts down the social construct of "feelings"? I know fuck-all about programming except that semi-colons are assholes but in any area of life being the new guy on deck means you can't afford to be a thin skinned egoist. I came here asking an honest question and received some honest answers. /g/ seems to be a valuable resource for getting unfiltered feedback, but like anything else you have to sift through the bullshit.
>>
>>45999258
>Encapsulation != OOP.
Encapsulation is one the main properties of OOP.
Point is, you don't use classes and member functions for performance critical code - meaning you don't use friends at all because everything is essentially public in the first place.

So as I said, friend is always shitty design, you use one or the other - OOP with only private functions touching the internal data, or you use a more data oriented approach where everything is free functions transforming bunches of data (generally arrays).
>>
>>45999249
A human can certainly do a better job. The problem is that a human will also make mistakes, especially after modifying the same code over and over again.

Compilers don't get tired and they hardly ever make mistakes.
>>
>>45997526
The problem with that is that they would do what plenty of C libraries do and just stick a prefix on everything. At least with a namespace you can "use" it if it's not causing any collisions.
>>
>>45999249
Compilers are terrible at the details, it's completely trivial for anyone with some intermediate assembly knowledge to beat the compiler.
What compilers are good at are the tedious stuff like register allocation, laying out the overall structure - alignment of data and labels, placement of the labels, rewriting expressions, constant folding, etc.
So it's typical to start out with C code, have the compiler get the basics right, then you go in and fix up the inner loops.
>>
>>45999313
>Encapsulation is one the main properties of OOP.
The idea to separate implementation and interface existed long before OOP.

>Point is, you don't use classes and member functions for performance critical code - meaning you don't use friends at all because everything is essentially public in the first place.
Wrong. This is true today because there are no wide-spread high performance language with decent module support. All we have is: C (no modules, encapsulation is only possible at the translation unit level) and C++ (basically the same + friends which is a workaround because they could not add module support into the language).
You write a module, user uses it via interface you define. Insides of module are visible for each other, but still not accessible for user.

Think of OS kernel: it exposes interface to work with kernel objects, but their implementation is still efficient, since everything is public inside the kernel.
>>
File: 1417287364130.jpg (50KB, 395x401px) Image search: [Google]
1417287364130.jpg
50KB, 395x401px
>THIS much autism and elitism from COMPUTER ONLY BABBIES

>b-b-but I know hardware b-b-b-because C/asm

oh my god i bet you fucking faggots cannot even pure CS aka MATHEMATICS
>>
>>45999409
>All we have is C, C++
I'd shill Ada at this point except it isn't remotely widespread outside of embedded infrastructure, defense, aerospace, etc.
>>
>>45998802
Memory unsafety is a good thing. Try writing a custom allocator without the ability to do "unsafe" pointer arithmetic and casting.
>>
>>45999023
I have only written assembler only applications for microprocessors but even in that case I would suggest getting a good simulator. I have used vmlab (avr hardware simulator) in the past and I really loved that piece of software.
OS is not important but it might be easier on linux.
>>
>>45996815
Not to be "that retard", but are leading underscores syntactically significant in c, or is it just for appearances?
>>
>>45999464
Underscores are just another symbol character.
>>
>>45999464
He is just being a retard.

>>45999472
C standard reserves names starting with underscore followed by capital letter. Such names should not be used in programs. What if keyword _Foo will be added in the next revision of C standard?
>>
>>45999453

I see.

I thank you all for your answers and have googled most of the info.

I will ask this again hoping I get an answer.
Considering I move to Linux as a dual boot and I am a complete beginner on pretty much everything, is there a book that I can pair with my assembly teachings so I learn more about how to use Linux, etc etc etc?
>>
>>45999511
They're not "syntactically significant" though.
>>
>>45997149
he mad
>>
>>45999409
>The idea to separate implementation and interface existed long before OOP.
But it wasn't called encapsulation.
Encapsulation is generally associated with OOP.

>Wrong. This is true today because there are no wide-spread high performance language with decent module support.
No it's true in general.
For performance you want access to the gory details, and not just the details of one entity, but you want a global view so you can compose transformation on batches of things. Trying to separate and hide details only complicates this process.
Transparent, POD objects with functional-style data transforms is both the best performance wise and it's actually more cleaner to code and design.

Lets say you wanna do a transform of A and B into C using some function T.
If you wanna isolate interface and implementation of the types A, B and C you have two options:
1. OO style, each A will take care of itself, you expose a public interface that performs action on it, and it will modify its internal state. This is terrible for performance because it pretty much limits you do scalar processing - even if B can see A's details, you still have to code A's methods as if they were single and isolated, and no compiler in the world regardless of language can do algorithmic transforms (and different data DO create different algorithms when you're after maximum performance)

2. Create an unwieldy n*m situation where A has functions for batch processing with A and B's, A's and C's and A's and B's and C's, and this repeated for each type.

Modular and OO style programming is simply not suited for batch processing data, you want exposed data details and then general, composable functions on top of this.
>>
File: niger_laughing.jpg (52KB, 536x400px) Image search: [Google]
niger_laughing.jpg
52KB, 536x400px
>manchildren defending their preferred language from snide comments made from other manchildren defending their preferred language from other
>so much butthurt in this thread
>>
>C is a high level language
This is how you spot a C elitist.
>>
>>45999428
>Memory unsafety is a good thing. Try writing a custom allocator without the ability to do "unsafe" pointer arithmetic and casting.
Oh, I didn't know that everyone at /g/ did that. My apologies.
>>
>>45999595
It's fun every now and then. Nice 95s.
>>
>>45999589
If effecient transformation of A,B into C requirest to access their internals, then this operation might be imlemented as part of module interface. You this operation should be implemented separately, then internals of A and B are not really internals, but part of the interface now.

I don't do image processing, so I mostly think of the OS. With OS working in separation from user processes, you are forced to define interfaces, simply because user program is not allowed to access OS internals. It is very hard to define efficient interface, but not impossible. Once proper interface is defined, its overhead is not noticable, since most of the work performed by the kernel module and it can access its internals to implement all operations effeciently
>>
>>45999749
>If effecient transformation of A,B into C requirest to access their internals, then this operation might be imlemented as part of module interface.
>then internals of A and B are not really internals, but part of the interface now.
Yes which would be solution 2.
But the problem with this is that's it's not scalable, and if your interface exposes essentially your entire module, what are you even doing? This is a square peg into a round hole.

This is why it's not even just performance, a functional+data oriented approach is actually cleaner, easier to code, easier to extend, easier to maintain.

>With OS working in separation from user processes, you are forced to define interfaces, simply because user program is not allowed to access OS internals.
When you need speed the kernel will actually map in some of it's pages into user space processes, gettimeofday() and clock_gettime() are good examples, they generally use vdso and the process just reads it 'directly' (well without heavy context switching into kernel space anyway).
>>
>>45999951
>This is why it's not even just performance, a functional+data oriented approach is actually cleaner, easier to code, easier to extend, easier to maintain.
That is because you do not actually need to extend data types when you do image processing. Here extending will mostly mean adding algorithms (functions). But some systems (like OS) need more extensibility: they actually need to work with data types defined from the outside. Interfaces here is the only solution.

>they generally use vdso and the process just reads it 'directly' (well without heavy context switching into kernel space anyway).
Very few things are exposed through vdso. And this also should be considered part of the OS interface. Those are not "real" OS internals, but special data prepated by OS for applications. Most of the time processes forced to use system calls.
>>
>>45999951
>>46000098
So you create some set of base classes user will be able to extend, and those are tightly tied together to achieve maximum performance without exposing unnecessary things. Usually you should use modules for that, but since C++ has no modules, friend classes is the way to go. They exist to compensate lack of modular programming support in the language
>>
>>45997989
Did you see Mickens co-taught an MIT course on security? It's on youtube.
>>
RUST IS CAPABLE OF ALL THE SAME THINGS AS C
>>
>>45994751
The ignorant usage of the term liberal indicates that you are either american or british, am i right?
>>
>>45997678
Yes

>>45998001
It is a high-level language.
>>
>>45998260
>Yet no support for infinite recursion with TCO, huh?
Anon, that's a compiler specific (and yes, GCC supports it).

>Function pointers aren't a replacement for first class functions.
I agree actually.

>Oh please. The preprocessor is shit.
I also agree.

>>45998425
>It's not portable.
Compiler specifics is outside the scope of the language standard, anon. There isn't any TCO specified in any Lisp standard either.

>On that note, does C even have anonymous functions?
C, no. Sepples, yes.
>>
>>45994522
>Why is people this retarded?

Wannabe elitists.
We have one guy like that in our research group - the code is written in Fortran and Python and he always rambles about how we should re-write all of it in Fortran because "Its faster and better!".

Yeah, sure, go and write a Fortran routine for a calculation step that makes up 0.1% of the overall computing time if it makes you happy.
>>
File: poettering.jpg (3MB, 3456x2304px) Image search: [Google]
poettering.jpg
3MB, 3456x2304px
>complaining about a community on 4chan of all places
grow a pair kid
>>
The greatest security failures of history have been a direct result of pretentious C programmers thinking they are smart enough to handle manual memory management.
>>
>>45994079
>Why is the C programming community so fucking elitist?
Because they deal with code architecture all day instead of fiddling with a language. Yet they get python kids who think they know shit about anything because they've been writing shit code in highlevel languages.

Alternatively you're dealing with people who read bad books and preach them as gospel. In which case you should just ignoe tham completely after you've made it clear for yourself what the issues are with what they're saying.
>>
>>45994598
>have friend
>ask me how people write C++ in text editors and compile
>show him an example and compile it in G++ using the terminal
>he thinks its cool

fuck you dude, im cool
>>
>>46002812
Compare and contrast C and Ada. Both involve manual memory management (unless you compile the Ada code for the JVM), yet one has a rep for buggy shitty code and the other is used when top notch life preserving safety is required. Somehow, I don't think it's the manual memory management that's the issue here.
>>
>>45994115
Lol you're the type of person OP is talking about.
>>
>>46002812
>>46003209
C is used a fuckton more than any other language for security critical software, so of course there are going to have been more historical errors in it. Also, memory errors are far from the only way a language can be insecure.
>>
>>45999428
>>45999702
This discussion has already happened in this thread. Not everybody writes memory management systems, but, for those who do, C is useful because it gets in your way the least.

>>45999230
As you say, the biggest assholes in the C community are the ones who use C for things other than what it's good at, and then get upset when most people who have a real, decent, use for C make extensive use of behavior that's taken for granted but not explicitly set in the spec.
>>
>>45994079
I have seen the same in arduino and linux communities. They think they are a big shot for being good at something so esoteric.

It's pitiful
>>
>>45994079

Because computer programmers are autists.
>>
>>46002685
>There isn't any TCO specified in any Lisp standard either.
Scheme guarantees it. It's part of the reason recursion is so popular with it.
>>
>>46000780
still shit
>>
>>45999078
>I don't know how computer's work but I am good at C.
This is why you will never write fast code except by accident.
>>
>>46003209
>Somehow, I don't think it's the manual memory management that's the issue here.
Part of this is the culture of not making a lot of heap allocations. But you're right, C has worse problems, such as array type decay (loss of length information whenever you pass arrays as function arguments), lacking support for discriminated unions, and in-band signaling for stream termination and error handling.
>>
>>45996854
this. just set up a fuckin macro in your editor
>>
>>45994115
This
>>
>>45994115
You're a giant fucking faggot.
Thread posts: 240
Thread images: 16


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