ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I still don't get how I can "accidentally" type "rm -rf /" and assemle it.
But you accidentally can remove files. And the point is that standard "C" library ('glibc' in Linux) "belongs" to "C"; in assembly it would be logical to use system calls. So, you make a mistake in a system call and delete a file instead of reading from it.
Now imagine that by mistake your program in whatever language executes
Code:
\rm -rf /
You're close to convincing me that the next time I experiment trying to learn bash scripting I should be in a different account containing nothing else of value.
But I don't think anyone is convincing anyone either way about the merits of that level of paranoia for learning asm.
Not knowing the language still only makes it easy to do by accident things that are fairly easy to do.
Very destructive programs are easy to write by accident in bash, but hard to write by accident in asm. Even if you know near zero asm and are blindly changing tutorials you don't understand and even if you're fairly competent in bash, you experiments in asm are still less likely to do serious harm than your experiments in bash.
BTW, I loved the metaphor:
Quote:
Originally Posted by Sergei Steshenko
programming in assembly is like touching completely skinned, but still living, CPU body.
But it ought to say "programming in assembly without an OS"
Programming in assembly without an OS is a more obscure skill than programming in assembly with an OS. I think there is plenty of justification for learning asm with OS, but never learning asm without OS. Even if you want to learn asm without OS, it is best to get some solid skills in asm with OS first. So despite the fun metaphor, I think that whole subject area is outside the focus of this thread.
Quote:
Originally Posted by Sergei Steshenko
The point is that you may accidentally delete a file.
You probably will accidentally delete a file.
At least once (long ago) while testing C programs I was writing, I accidentally deleted a file. More than once while trying to correct someone else's bad Python programs. More than once while experimenting with bash. And despite my incredible asm skills, at least once (very long ago) while learning to do file I/O in asm, I accidentally deleted a file.
I wouldn't do such experiments even in the directory where I have important files. When I'm at all uncertain of file I/O operations, I generally avoid even working with file names similar to important files elsewhere.
Since I tend to multi task with a lot of open windows, experimenting in a different directory from real work is natural. Experimenting in a different login from real work is a significant step less convenient and I generally wouldn't do it.
You're close to convincing me that the next time I experiment trying to learn bash scripting I should be in a different account containing nothing else of value.
But I don't think anyone is convincing anyone either way about the merits of that level of paranoia for learning asm.
Not knowing the language still only makes it easy to do by accident things that are fairly easy to do.
You're close to convincing me that the next time I experiment trying to learn bash scripting I should be in a different account containing nothing else of value.
...
This is the way I initially tested Skype for Linux - a closed source app, who knows what it is doing
...
Programming in assembly without an OS is a more obscure skill than programming in assembly with an OS. I think there is plenty of justification for learning asm with OS, but never learning asm without OS. Even if you want to learn asm without OS, it is best to get some solid skills in asm with OS first. So despite the fun metaphor, I think that whole subject area is outside the focus of this thread.
In my professional life programming in assembly without an OS was a must, i.e. a job duty. I.e. I do not see too much sense in learning an assembly nowadays unless ultimately it will be used for programming without an OS.
Well, but if someone is going to write a full fledged compiler, it's another story.
I do not see too much sense in learning an assembly nowadays unless ultimately it will be used for programming without an OS.
Even if you will never write a useful line of asm code, learning to code in asm with an OS, is a valuable skill that will improve the quality of your programming in languages like C++ as well as your skill at debugging.
Learning to code in asm without an OS would mostly be useful if you intend someday to write or significantly modify an OS. (I myself have done so, but don't expect to do so again).
Coding and debugging C++ is a more commonly useful skill than modifying an OS. So asm with an OS is more relevant knowledge than asm without an OS.
...
Learning to code in asm without an OS would mostly be useful if you intend someday to write or significantly modify an OS.
...
Not at all. I am from HW world, so, say, when a chip with CPU inside needs to be simulated using an HDL, someone has to provide the model with code which works from reset on. And at least reset and exception handling routines were written in assembly.
Likewise, when the chip is taped out, it needs to be tested - no OS at all is present. So reset and IRSs are written in assembly, and the rest in "C".
In HW world there is a term "bring up" - it the place for assembly.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.