flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3, 4, 5 Next |
Author |
|
kohlrak 25 Jul 2006, 00:50
What i'd like to see would be competition for java and flash. Something in Assembly that works like java or flash, only since the targets will be for performance and cross compatability, it should be better than something that just targets portability.
|
|||
![]() |
|
f0dder 25 Jul 2006, 11:41
kohlrak wrote:
If you worry about formatted I/O speed, either you're doing very simplistic stuff or you're worrying too much. Only in a few special cases does this really matter. I'm not too much of a fan of C++ iostreams because on many implementations, for the smallish projects I do most of, they pull in too much functionality - including the not-so-useful localization stuff. There's a bunch of advantages to them, though. Compile-time type safety. Centralized formatter support. Extensibility (how would you add arbitrary object printing to printf()?), etc. C++'s standard library is as much a part of the language as libc is part of the C language. kohlrak wrote:
That's doable in C++ as well - the "ellipsis argument list", like void foo(char* output, ...);, and then use of <stdarg.h>:va_start,va_arg,va_end to process. There's often cleaner ways to do stuff in C++, though. kohlrak wrote:
What makes it easier? I can't quite follow you here. Your last sentence doesn't make much sense either. kohlrak wrote:
A person attempting anything large in assembly, especially if it's teamwork, is a bit crazy ![]() Playing a bit on the large blob of text you quoted, I could add the following... Speed is probably the biggest complaint 1337 Asm0rs have against High-Level Languages. They refuse HLLs because it's slow and bloated, and then they turn around and write even slower code in assembly. - ^_^. My "bin2obj" program is written in C++ (yes, using objects) and the exe is still just 4kb. Bloat? _________________ ![]() |
|||
![]() |
|
Patrick_ 25 Jul 2006, 14:34
Again, it all goes back to choosing the right tool for the job. Sometimes a high-level language will be more practical for your project.
What I really don't like is people bashing things they don't know much about. For example, a C++-only coder, who thinks any non-OO language is a waste of time, and assembly is worthless. It's good to know at _least_ a little about a lot. Knowing a very low level language (asm) can be _extremely_ beneficial. In fact, by learning and using assembly to program, I've learned more about how my hardware works, and programming, and I believe I've become a better programmer in general because of it. |
|||
![]() |
|
kohlrak 25 Jul 2006, 18:13
kohlrak wrote:
That's doable in C++ as well - the "ellipsis argument list", like void foo(char* output, ...);, and then use of <stdarg.h>:va_start,va_arg,va_end to process. There's often cleaner ways to do stuff in C++, though. Code: void function(int a, int b){ //Pretend code is here... return; } void main(){ function(2); return; } I was told that code would compile in C, and i know for a fact it won't compile in C++. And incase you're about to ask me then how printf works...? Code: exturn "C" Sometimes works, not to forget that you can overload functions too. Quote: In fact, by learning and using assembly to program, I've learned more about how my hardware works, and programming, and I believe I've become a better programmer in general because of it. And so have i, but i knew a slight bit from C++ coding on certain community forums. None of them knew assembly but a few correct rumors about assembly were passed about... Only a few though... the rest were just bashing assembly, and i'm sick of it. lol |
|||
![]() |
|
okasvi 25 Jul 2006, 18:56
kohlrak wrote:
I believe it's 'extern'. _________________ When We Ride On Our Enemies support reverse smileys |: |
|||
![]() |
|
kohlrak 25 Jul 2006, 19:06
I never spell it right because i never use it. lol
|
|||
![]() |
|
rugxulo 26 Jul 2006, 03:36
Does Context count? It's similar to C, kinda sorta.
![]() okasvi wrote: I'd like to see C(not C++) that uses fasm as backend and has samekind of design principles or atleast allows fasm to be used in __asm{}. |
|||
![]() |
|
f0dder 26 Jul 2006, 08:29
kohlrak wrote:
That won't compile in any sane compiler. Also, "void main" is plain wrong and nonstandard, it's "int main()" - and you really ought to do "int main(int argc, char* argv[])". How printf works? The definition is something like "int printf(char *fmt, ...);" - how it's implemented is up to the library writer, but probably with va_{start,arg,end} calls. |
|||
![]() |
|
kohlrak 26 Jul 2006, 19:49
void main() compiles in MSVC.
|
|||
![]() |
|
f0dder 26 Jul 2006, 19:53
It might compile, but it's nonstandard. I can't see why it should cause problems anywhere, but it's bad karma to do...
|
|||
![]() |
|
kohlrak 26 Jul 2006, 20:03
I prefer it.
|
|||
![]() |
|
okasvi 26 Jul 2006, 21:10
rugxulo wrote: Does Context count? It's similar to C, kinda sorta. Looks nice and ceeish ![]() _________________ When We Ride On Our Enemies support reverse smileys |: |
|||
![]() |
|
f0dder 27 Jul 2006, 10:19
kohlrak wrote: I prefer it. Why? it's wrong... Most C/C++ implementations return the value from main() to the operating system, which on many systems can be checked ("errorlevel" in dos). This is crucial for console mode apps of the type that can be used from shell scripts/batch files (ie., if the tool doesn't return 0, some error happened and we need to abort). Using "void main" means whatever junk is present in EAX will be returned. Bad idea. A conforming C++ compiler actually ought to reject main() functions with a nonstandard signature. For a C program, GCC warns about it (on the *default* warning level!), and for a C++ program it gives you an error. MSVC doesn't warn or error on either, which is to be seen as a compiler bug. _________________ ![]() |
|||
![]() |
|
vid 27 Jul 2006, 12:18
it just mean your program DOESN'T return value. It same as stating that function declared as returning void is bug - it also leaves junk in EAX, which can be tested some way
|
|||
![]() |
|
f0dder 27 Jul 2006, 15:06
vid wrote: it just mean your program DOESN'T return value. It same as stating that function declared as returning void is bug - it also leaves junk in EAX, which can be tested some way WRONG - main() is a special function, and the standard clearly says so. If "void main()" doesn't break on your system, that's just luck... or rather, it's bad, because it'll leave you to believe that it's okay code, and might then blow up in your face later. (yes, the C standard allows for non-int main(), but the results are "undefined". The C++ standard explicitly requires int-main). _________________ ![]() |
|||
![]() |
|
vid 27 Jul 2006, 16:21
system doesn't care about return code of app - it's caller that does. same way as in functions.
what is reason to treat this one thing specially? if program doesn't have anything to return... |
|||
![]() |
|
f0dder 27 Jul 2006, 16:27
vid wrote: system doesn't care about return code of app - it's caller that does. same way as in functions. Sure... but if you use a tool from a makefile, you better damn be sure that it returns 0. vid wrote:
Why treat callbacks specially? If they don't have anything to return... main() is called from an external source outside of your control (ie, the libc crt0 code) - so it's a no-brainer, really, that it should follow a standard signature. Try making it STDCALL, for instance. Btw both GCC and VC2003 "xor eax, eax" if you don't return anything from main. For "int main" without a return statement this is standardized because it implicitly returns 0 then. For void main, this smells more like a fix for bad and broken code... any other void function does NOT have EAX cleared on exit. _________________ ![]() |
|||
![]() |
|
kohlrak 27 Jul 2006, 20:02
f0dder wrote:
Therefor, the EAX goes back to what called the main function (opened the program). Simple enough, but the fact is. What does it do? Nothing... It is unused. If "the program crashes" it's the same as a program that "crashes" using "int" type. Theoretically, you could simply make main a bool value, but even that is not needed. It appears to me you care about int so much because it's part of "windows' troolean logic." Essentually, unless you call the program from a special CMD edit or such, the data isn't even looked at that i know of. |
|||
![]() |
|
f0dder 27 Jul 2006, 20:14
Whatever.
Seems like you like undefined behaviour, I don't. |
|||
![]() |
|
Goto page Previous 1, 2, 3, 4, 5 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.