C doesn't seem so great anymore

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
User avatar
Oranos
Member
Member
Posts: 29
Joined: Sat Oct 15, 2011 6:52 pm
Location: Land of Bald Eegels

C doesn't seem so great anymore

Post by Oranos »

Anyone else wanting to just work in pure assembly because you'd rather always have the control and nothing seems problematic about programming large software with it? Not only am I finding it somehow more comfortable, but it almost seems essential. I no longer appreciate C's "memory model" or whatever it may be called. It's starting to seem like there really was no need to introduce programming languages like C anyway..

Is this a normal thought? Apparently not :|

Hah. I'm not writing this to sound like "someone's a badass" but I'm just starting to genuinely wonder why programming in ASM is viewed as so bad and unproductive. Any thoughts?
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: C doesn't seem so great anymore

Post by VolTeK »

I remember my assembler only phase.

I then realized that C is a faster way of getting my thoughts out, without spending all of my time on the language (Which is like solving a math problem, and explaining every step in large detail, which after a while is just time consuming when you get into even larger problems). In my real mode OS projects, it was much more fun writing the core in Assembler as it just felt more challenging and exciting.

Its good for everyone to have swam in assembler for awhile, and have been grateful of the control. Eventually you'll want something that can output your ideas much faster with somewhat similar (if not, equal) complexity.


Let your phase ride out. You'll learn a lot, and come back a lot better mentally to C.
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

Re: C doesn't seem so great anymore

Post by linguofreak »

Oranos wrote:Hah. I'm not writing this to sound like "someone's a badass" but I'm just starting to genuinely wonder why programming in ASM is viewed as so bad and unproductive. Any thoughts?
One reason is that assembly is very unportable. Any assembly code in a program has to be completely rewritten when it's ported to a different hardware architecture, and differences in calling conventions and such may well mean that an application program written in assembly has to be fairly heavily rewritten when ported to a different OS, even if the set of function calls it makes is exactly the same.
User avatar
Oranos
Member
Member
Posts: 29
Joined: Sat Oct 15, 2011 6:52 pm
Location: Land of Bald Eegels

Re: C doesn't seem so great anymore

Post by Oranos »

@Voltek
Excellent answer. :o

I sorta anticipate that anyway; however, I also believe maybe with enough practice I'll mostly be able to capture my ideas even in assembler alone. I know exactly what you mean though. I had a similar experience when shifting down to using C, but now I find it absurd to use anything more than C. Actually, I was working with C++ and decided I wasn't happy with my style. Coincidentally, it reduced to C++ "without ++" (C99) over several years as I gradually dropped concepts such as its crazy template system, polymorphism, operator overloading and even class methods.

I feel like I made a perfect decision and I'm completely satisfied with how I've relearned how to program. If you really know how to grapple representation, most, if not all "high-level" features become inane.

@linguofreak
Definitely. I guess I've neglected that factor because I'm not too mindful about portability at the moment. I only have one machine to play on.
User avatar
iansjack
Member
Member
Posts: 4683
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: C doesn't seem so great anymore

Post by iansjack »

Your remarks about "memory models" in C, and the failure to grasp that you use them just as surely in assembler as you do in C, would seem to me to indicate an incomplete appreciation of what is involved in programming a complicated operating system. Although it proves nothing, have you considered why almost every operating system since the original Unix implementation is written in a higher level language than assembler (often C)? Are all those experienced programmers and designers wrong where you are right?

They say that a little learning is a dangerous thing. I'd say that your OP is a good demonstration of that. I don't believe that you have enough experience of programming a reasonably complex system to appreciate the advantages gained from using a higher level of abstraction than assembler. The same seems to be true about the advantages of C++ over C when writing complex user programs. Keep at it and, with experience and time, you will begin to appreciate the power of abstraction.
User avatar
Oranos
Member
Member
Posts: 29
Joined: Sat Oct 15, 2011 6:52 pm
Location: Land of Bald Eegels

Re: C doesn't seem so great anymore

Post by Oranos »

Yep.
User avatar
qw
Member
Member
Posts: 792
Joined: Mon Jan 26, 2009 2:48 am

Re: C doesn't seem so great anymore

Post by qw »

In assembly you still need a memory model.
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: C doesn't seem so great anymore

Post by Kevin »

Being able to write anything in assembly is useful and something worth investing into. Actually doing it, however, is not productive. If you do real projects in assembly, you'll write worse code, slower. The only real reasons to use more than a few lines of assembly are learning or because it's fun and you're not going to use the result anyway.
Developer of tyndur - community OS of Lowlevel (German)
OSwhatever
Member
Member
Posts: 595
Joined: Mon Jul 05, 2010 4:15 pm

Re: C doesn't seem so great anymore

Post by OSwhatever »

Many low level programmers have a assembler only phase and it's nothing wrong with that for small projects. By using only assembler you actually learn a lot how a computer system work to the bare metal which helps you to understand what's going on under a high level language. For larger projects like operating systems, C or C++ is usually better not to mention how much more portable to other architectures it is.

Today it isn't unusual for kernels being written in C++ but there are more modern languages available like D and there are rumors that Microsoft is going to create their own native code language http://lambda-the-ultimate.org/node/4862. I think as times progresses, we will use more high level languages even for system programming.

We'll see if there will be a new compiled language to rule them all in the future.
User avatar
bwat
Member
Member
Posts: 359
Joined: Fri Jul 03, 2009 6:21 am

Re: C doesn't seem so great anymore

Post by bwat »

Some of us had an assembly only phase because the only other option was BASIC. As soon as 16-bit computers became affordable for hobby programmers we all jumped ship and wrote K&R C code instead. OK, not all of us did that, some of the hobbyist games programmers moved onto 68000 assembly. In the last two years I've only written about 500 lines of assembly code.

The older you get, the more you realise that your time is a valuable non-renewable resource. It therefore needs to be used efficiently. For 99% of the time, writing it in assembly isn't going to be efficient use of your time.
Every universe of discourse has its logical structure --- S. K. Langer.
jbanes
Posts: 12
Joined: Mon Dec 30, 2013 11:54 pm

Re: C doesn't seem so great anymore

Post by jbanes »

Oranos wrote:Hah. I'm not writing this to sound like "someone's a badass" but I'm just starting to genuinely wonder why programming in ASM is viewed as so bad and unproductive. Any thoughts?
Someone already mentioned the portability issue. But I think the reason why you're going through this "phase" (which we all go through) is that what the C compiler is doing is rather opaque. Until you can get a good handle on it, it feels easier to say "screw it" and just write the code in assembler. Eventually you are forced to understand it and get too lazy to keep typing low-level code. That's when you'll start seeking out higher level options.

I hear you on C++, though. C++ was a mistake from the beginning, but a good learning experience for the industry. Java implemented the OOP design that was desired, but the industry zietgiest is starting to realize that we were all a bit too zealous for what OOP offered. (Which really just amounts to formalizing a number of encapsulation structures that will continue to be useful in the future.) The next generation of languages is modern functional languages which take the event-based programming model already used in OSes and promote it to The Way All Things Are Done(TM).
iansjack wrote:Although it proves nothing, have you considered why almost every operating system since the original Unix implementation is written in a higher level language than assembler?
That's right. Real Men write operating systems in ALGOL! :lol:

(Sorry to bust your chops. I just couldn't resist. :))
User avatar
iansjack
Member
Member
Posts: 4683
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: C doesn't seem so great anymore

Post by iansjack »

Real men write operating systems in PL/1. Wimps use BCPL.
jbanes
Posts: 12
Joined: Mon Dec 30, 2013 11:54 pm

Re: C doesn't seem so great anymore

Post by jbanes »

iansjack wrote:Real men write operating systems in PL/1. Wimps use BCPL.
:-k [..................................................................] =D>
User avatar
Oranos
Member
Member
Posts: 29
Joined: Sat Oct 15, 2011 6:52 pm
Location: Land of Bald Eegels

Re: C doesn't seem so great anymore

Post by Oranos »

Meh.




I just thought I'd say I'll try working with some intrinsic functions and see if anything's more convenient when using a combination of assembly and C. Though, the lightweight-ness and simplicity of an assembler is pretty great too.

I really don't think my C experiments will be any more eloquent; most likely horrid and convoluted.

One more note: My best practice is to just draft informal pseudocode and work on note paper to sketch out complex/novel ideas. I don't use C to draft code in the first place.
User avatar
mathematician
Member
Member
Posts: 437
Joined: Fri Dec 15, 2006 5:26 pm
Location: Church Stretton Uk

Re: C doesn't seem so great anymore

Post by mathematician »

I suppose C is just a lot more pleasing on the eye than the same thing written in assembly language, with all those jumps all over the place. I used to think that interrupt handlers should be in assembler, even if everything else was in C - until I wrote my keyboard handler in C, and saw how much "nicer" the C code was.
The continuous image of a connected set is connected.
Post Reply