Is there any real advantage that comes with learning C double plus (C++) over C hashtag (C#)?
Is there any real advantage that comes with learning C double plus (C++) over C hashtag (C#)?
ewww hungarian notation
Me on the right
Jesus, I find him rambling, strange, but utterly engrossing.
Too bad I'm a CIA nigger.
this
>C hashtag
Why not just create a C# class retard, and instantiate it wherever you need it.
class PhysicsHitResults()
{
public uint index;
public uint blabla;
}
That's like asking if learning hammer is better than learning screwdriver for carpentry.
Learn both, use what's appropriate.
Those.
I'm fine with Hungarian notation, but in this case it's just "ui" for "unsigned int" and "v" for vector, so it doesn't bring any of the benefits that Hungarian notation is supposed to.
I agree. Although people really need to stop using analogies like this when referring to software.
>Although people really need to stop using analogies like this
Feel free to explain why you think that.
Aside from a number of libraries that aren't a bad meme?
If going with C# means you need to use that shitty font, then I vote for C++.
Botnet#
lmao yes my man yes. you are the truth
C#, all of the C++ bloat and verbosity without it's only real benefit (performance) brought to your by microsoft^tm!!
how braindead do you really have to be to use this garbage, even java is a lot better
I would like to make a point here for a minute. What you are calling C# is infact a crippled artifact of Microsofts .Net/Longhorn attempt that had the purpose of avoiding the memory management stupidity of Programmers and also crippling their ability to develop cross platform software.
They also abuse the good name of C++ while basically implementing a worse java with a "better" vm. People think thats the same naming thing "java"script/emscript pulled, but they also tried to destroy that by steamrolling IE with VB-script support in the past (and also later with the failed silverlight bullshit). Embrace, extend, extinguish didn't work for C++ with WinApi anymore so they tried to build a Use-our-platform or die strategy here, that collapsed before ever coming into the light.
Read the Vendor-locking section and related articles from the 2000s if you want a broader pciture:
en.wikipedia.org
Don't buy into Microsofts shit. Ever.
If you want actual solution to the task Microsoft originally tried to solve with .Net (solve C/C++ memory management Problems), use Rust, even if its young. Its cross platform, it works and it solves all the unsolved problems .net/java have created with grace.
Why would ANYONE use C#? What context is it even taught in? No CS program would use this shit. No penniless hack would use this shit. No self respecting programmer would tie their language to business decisions. It's strictly for poor M$ employees forced to sew their mouths to their assholes. It was DOA as far as I'm concerned.
Just look at the incestuous list of software:
en.wikipedia.org
Shit is USELESS.
>Hashtag
Kill your self
It was the absolute best mainstream languages between 2007 and 2011, user.
The Microsoft stack is still pretty amazing. Dev tools is the one thing MS actually excels at.
>paint.NET
>bad
Opinion discarded.
>Pajeet, this is Bill, we have a situtation, report to Sup Forums!!
The only dev tools you need are a compiler, text editor, and some libraries. Everything else is a company tricking you into buying useless shit that obfuscates what the fuck you are actually doing.
MS Dev tools are the worst thing in my option. Have you met Linux perf tools yet? Have you met GDB/lldb? Have you even looked outside your VS/.NET box or anywhere in the unmanaged/server space (where its all linux only)?
Just because it gives you a friendly interface you can click with a mouse on doesn't mean its good. Its actually terrible because you got no idea whats going on besides what it tells you and you have zero room to improve or script it to do what you want. You are completely vendor dependent and if you even start to compare licensing fees here you will quickly come to the conclusion you are getting raped for what little they give you here. yes raped.
This guy gets it.
Low-level access that allows for higher performance optimization.
But that is only useful in small handful of applications. Majority of time, the maintenance improvements you get from using C# far outweight anything else.
How would you go about pretendih that eg an int32 is a char[4] array in c#?
C# is a crutch that prevents understanding why what you just wrote is O(exp) rather than O(1)
No. It is obvious what complexity algorithm is from reading the code.
You just can't control the memory, which is where most real performance problems come from.
You can't "pretend" but you can convert from one to another.
Well, you can "pretend" if you use unsafe, but no one sane uses that.
Hungarian notation has ZERO benefits.
We hated it in the 90's and we hate it now.
Using LayoutKind.Sequential and omitting the FieldOffset attributes will work for your case since you don't actually overlap items. Pic related.
That's actually what FieldOffset does.
[StructLayout(LayoutKind.Explicit)]
public struct Example
{
[FieldOffset(0)]
public int Integer;
[FieldOffset(0)]
public char[] Array;
}
In that example, both Integer and Array are located at offset 0 from the start of the memory allocated for an Example instance, so you can change Integer and Array will be affected, and vice versa.
Do you oppose things like postfixes to denote structs, enums, unions, and the like? For example
stuct_s s;
enum_e e;
union_u u;
I think they are useful for making clear what a symbol is just by looking at it.
Or how about library prefixes, like how OpenGL does shit with glFunction().
And thinking about OpenGL, do you think the typing in the function names was a bad idea? It was necessary for C.
>I think they are useful for making clear what a symbol is just by looking at it.
Most IDEs show that in some way.
>Or how about library prefixes, like how OpenGL does shit with glFunction().
Namespaces exist for a reason.
>Most IDEs show that in some way.
I don't use an IDE, just vim.
>Namespaces exist for a reason.
From a C++ perspective you are absolutely correct.
>just vim
80s called. They want their memes back.
>I think they are useful for making clear what a symbol is just by looking at it.
What help is gained knowing if something is a union or a struct?
The only thing you need to know about a type is its fields (if it's a record type) and what kind of functions you should call on it. No special notation or naming convention helps with that.
I do it to differentiate types from variables on a word basis.
For example:
type a; // No distinction between type names and variable name
type_s b; // Distinction
I just find it easier to read and catch mistakes this way.
See this guys answer
You really, REALLY should be using an IDE if you want to do anything productive. Especially with large projects in C# or Java.
I suppose you could modify Vim to have the functionality of something like Visual Studio.
>just vim
yaeh fuck off, you have no more than 1000 lines of code apparently. come back here to discuss when you have a real project in your hands.
> C# or Java
Thanks for the laugh user.
It's called "taking time to design and comment your program".
>laughing at JAVA
Should I laugh at your empty wallet, dorito fingers and basement?
Naw, cutting edge EE research lab. We need shit to run fast, and I know how to do that.
>It's called "taking time to design and comment your program".
you really have no idea how project management is done. When the project tree becomes more complex, you gonna have to use something to assist, which is IDE.
classes in c# are dynamically allocated unlike structs i believe so you probably dont want to go making new class instances every frame for a physics sim
No, you design an interface and program against that. When you have to totally redesign your entire every time you need to extend it, you didn't design it well. It's called modular design.
>Research lab
Leeches, wasting x4 time to do the same job its fun doesn't?
>We need shit to run fast
Nigger please at least say you need C to code PICs or other dedicated hardware. But to save computing resources? Its not the 80's you know.
>Look we save 4.5 seconds! Yay!
>user you wasted 40 man-hour more
ITS C SHARP YOU ILLITERATE ASSBREATHING MOTHERFUCKER
>It's called modular design.
Its called Autism
Not him, but its only Java that I've found to be difficult to develop in without an IDE. Generally I program in C and C++ and all I need is a commandline with vim and gdb for debugging. Of course I do use some vim plugins but I really don't feel like I've ever needed an IDE for C/C++.
Nigga pleas. Try propagating electromagnetic fields to build a 175000 x 100000 matrix and invert it at video framerates and see how far you get. I imagine the first solution you'll get will come out sometime next month if you used C#.
Ikr they are called cepples and sharpie here.
>double plus
toplel
>NOT C CROSS CROSS
FOR FUCKS SAKE
Actually there is a call function for it on C#
where is your god now?
What the fuck is this meme about high performance programming being somehow easier or faster in C# or Java compared to C and C++. Its not, if you're doing high end stuff, well, you won't be letting the garbage collection just do what ever it wants, oh no. Its a constant fight against it if you're going for performance, so you will be spending time on that. Besides, the level of verbosity of C#, C and C++ is nearly equal. In fact, Java is the most verbose language of them all with all the mandatory exception handling and other bullshit. Not to mention having to wrap everything into a class in C# and Java, adding extra work.
class YouForgotToMentionThatEveryIdentifierInJavasStandardLibraryTakes80CharactersToFullyWriteOut.
Not him but people end up actually start talking about carpentry. Pic related. Now expand on your answer.
I think you'll find that it's C pound, actually. Or, alternatively C octothorp.
Psh, everyone knows C++ is pronoiced dagger dagger, and C# is C double dagger double dagger.
You'll get a job one day
Thought you guys might find this interesting.
>anywhere in the unmanaged/server space (where its all linux only)?
You are either a fuckin idiot or have only worked for tiny poorfag vendors or non commercials. Everyone that relies on their machines to work uses windows servers for certain tasks.
You know, since that is packing the structs exactly in C# the C++ version could have some use issues. Structs tend to get random bits of memory jammed in to round up bit values, so things aren't aligned as they should be bit wise.
>vim
:YcmCompleter GetType
map it to something shorter if you want
>inb4 not using ycm
C hashtag is more windows friendly, so bloated, slow and unstable.
People like it only because their boss ask them to work with.
So you're saying that harmonically we should be calling it Db?
Speak for yourself.
>What help is gained knowing if something is a union or a struct?
Go back to writing fizzbuzz.
C# (pronounced C Sharp) is pretty much a nicer looking Java. There's a lot of standard library to do most tasks with, independent of the operating system it's being run on. It uses a garbage collector, so memory management is automatic, but non-deterministic. Code is compiled to an intermediate language, rather than native code, which is then recompiled to native code at runtime (JIT compilation), which invokes a one-time performance hit. This can, however, generate more optimized code due to the ability to profile based on the CPU of the target platform (in practice, it's still usually slower than native by a factor of around 2). Both C# and Java promote an object-oriented style of programming, and C# defaults objects to being stored on the heap (Java requires this) rather than the stack, which may result in numerous cache misses from unnecessary fragmentation of memory.
C++ (pronounced C Plus Plus) is C on steroids. It's a system's language, and packs a rather useful standard template library for various data structures and I/O features, although it isn't as feature filled as on C# or Java (third party libraries may be used for various functionality, such as networking). Because it is a system's language, C++ does not use a garbage collector, instead relying on scope-based memory management -- which is in some respects still manual (you have to define destructors for your own objects, or manually free any raw pointers you use with new). Programmers have a greater control over how memory can be arranged, and whether it is placed on the stack or heap, thus making optimizing for cache locality easier. In general, C++ is used for any software that needs to be fast, even if it will take longer to write.
>in practice, it's still usually slower than native by a factor of around 2
Have citation for that?
More free software projects use c++.
But if you learn one, you can easily use the other.
so don't write shitty code.
>that example
C# is 100% defined, C++ depends on compiler - it might change aliasing or even reorder shit(my bmp parser broke because of that). C# is a unique language - it has the highest number of low-level and high-level features, it makes it not only pleasurable to develop in, but also makes it one of a kind glue language. You can pass fucking closures as callbacks to your imported from a dll C code, you can manually allocate memory with winapi or C library functions, it will just fucking work. It's also an open standard.
The only good dev tool Microsoft made is Visual Studio used for C++.
Oh and he could set LayoutKind.Sequential and not bother with offsets.
>hashtag
>actually ++++
kys tripfag, or go to reddit where you can enjoy the fame
Right, and what about if you're memcopying it or sending it over the network, or you want to create a structure resembling the first structure for casting purposes?
Holy shit, I never realized that.
In C# structs are allocated on stack.
Choose C# if you want Java: Microsoft Edition
because some people dont have mums basement to live in, and c# will get you a job
"C double plus"
oh my god hahahah thats a new one
I heard it is used in SE courses.
Apparently it is decent for database handling, but I don't know.
I go to a school focusing on game development (I know, lel) and the focus for non-engineers like myself is C#, I guess because of Unity.
>or even reorder shit
If you didn't mix for whatever reason private and public data fields, I call bullshit. Alignment and endianness can fuck your shit up though, use a proper serialization library.
>For non-union class types, members with the same member access are always allocated so that the members declared later have higher addresses within a class object. Members with different access control are allocated in unspecified order (the compiler may group them together). Alignment requirements may necessitate padding between members, or after the last member of a class.
>What help is gained knowing if something is a union or a struct?
user, there is a HUGE difference between unions and structs. Unions have their fields occupying the same location in memory. If a type has two fields, x and y, you can set both of them safely if they're a struct, but if they're a union, changing x changes y and vice versa.
While I won't argue for changing the names of types or variables based on whether they're unions or structs, you should not consider this information irrelevant. If you are working with a union, it is imperative that you know that it is a union.
It's just my experience from seeing a few benchmarks. If you want to see C# being demonstrably slower than C++ though, have at this benchmark:
benchmarksgame.alioth.debian.org
Take note of my wording. I say C# defaults objects to being on the heap. If you want stack allocation, you can make structs of course (you can't in Java), but it's not what most objects you'll be working with (i.e. almost the entire standard library) will be using.
You don't have to use C# for Unity. They are stealing your money.
And people like you are why Reddit is better than Sup Forums.
you do if you dont want to learn "unityscript" that has no use outside of unity
>They are stealing your money.
In this country education is free including university so not exactly, but quite true. I haven't even used Unity here despite it being a big part of the curriculum - I've been teaching myself C/C++ all year long and while others made their projects with Unity, I made mine with OpenGL and SDL.
UnityScript as far as I understand is just a modified version of Javascript. I haven't used Unity but I've used Godot and it has a similar thing but it's language is based on Python. Its mostly the same as python, really, except you have to declare functions with the keyword "func" and variables with the keyword "var".
>C double plus
>C hashtag
Not using
>C increment
>C pound
It's C quadruple-plus you mongoloid
Who the fuck are you quoting mad nerd?
my nigga
>C#
oh wait he's actually serious. let me laugh even harder
i bet you think a monolithic kernel is superior to a microkernel and that the IPC problem is just too hard