flat assembler
Message board for the users of flat assembler.

Index > Heap > Do you like my coding style ?

Author
Thread Post new topic Reply to topic
m



Joined: 28 Dec 2006
Posts: 304
Location: in
m
Hi all !

Please do not hit me with a slap-stick if I'm acting stupid !

But I'm really curious.

So every one of you, who has downloaded my crappy-little-thingy (programmes from Project and ideas) ... please let me know that my
    code-sucks
    code-is-crap
    code-should-be-dumped into outer-space-waste-pile-recycling plant

or anything like that.

Please ... am I sounding meaky, stupid, strange or block-headed-dumb-fellow-from-a-different-planet-not-known-to-humans-and-popular-for-its-chaotic-species evolution ?
Post 14 Mar 2007, 12:55
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
You sound paranoid Shocked . you won't commit suicide if they give you the bad news will you? Surprised Razz
Post 15 Mar 2007, 04:30
View user's profile Send private message Reply with quote
m



Joined: 28 Dec 2006
Posts: 304
Location: in
m
nope ... never

what's this ... just a single response !
Post 22 Mar 2007, 05:22
View user's profile Send private message Reply with quote
HyperVista



Joined: 18 Apr 2005
Posts: 691
Location: Virginia, USA
HyperVista
I looked at your posts where you provide code examples and I think you already got some good feedback, didn't you?
http://board.flatassembler.net/topic.php?t=6736

believe me, if your code style sucks, you would have heard about it already, first by vid, no doubt Laughing
Post 22 Mar 2007, 12:21
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
believe me, if your code style sucks, you would have heard about it already, first by vid, no doubt
only when i am bored Smile
especially if i had to download and unpack archive to see code, i can "fail" to report code suckery

m: next time, post also examples of your code along with post like this
Post 22 Mar 2007, 12:45
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
yes, your code sucks a little, but i have seen worse.

my complaints:

1. you should insert some blank lines between some "blocks" of code which do just one thing.

for example:
Code:
        push    NULL
        call    [GetModuleHandle]
        mov     [ebx+WNDCLASSEX.hInstance], eax
        push    IDI_APPLICATION
        push    0
        call    [LoadIcon]
        mov     [ebx+WNDCLASSEX.hIcon], eax
        push    IDC_ARROW
        push    0
        call    [LoadCursor]
        mov     [ebx+WNDCLASSEX.hCursor], eax    
would be nicer as
Code:
        push    NULL
        call    [GetModuleHandle]
        mov     [ebx+WNDCLASSEX.hInstance], eax

        push    IDI_APPLICATION
        push    0
        call    [LoadIcon]
        mov     [ebx+WNDCLASSEX.hIcon], eax

        push    IDC_ARROW
        push    0
        call    [LoadCursor]
        mov     [ebx+WNDCLASSEX.hCursor], eax    

also you could comment each such block

2. Remember that most winAPI functions can return error. You should always check that error. This is most common problem of asm coders, probably because bad tutorials (iczlion) teaching to do things this way
Post 22 Mar 2007, 12:49
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
m



Joined: 28 Dec 2006
Posts: 304
Location: in
m
Inserting blank lines ... already done that !
Checking for errors returned by non-critical function ... waste of cheap time !
Post 26 Mar 2007, 10:38
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
Checking for errors returned by non-critical function ... waste of cheap time !

not at all. Without it your application is always buggy (crashes under some circumstances). Even things like CloseHandle are worth of checking, because it helps you to locate some bug in your code faster.

That is gain of time, not waste
Post 26 Mar 2007, 10:47
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
f0dder
vid wrote:

This is most common problem of asm coders, probably because bad tutorials (iczlion) teaching to do things this way

...Or perhaps because a lot of asm coders are lazy? Smile
m wrote:

Checking for errors returned by non-critical function ... waste of cheap time !
Post 26 Mar 2007, 11:03
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
Or perhaps because a lot of asm coders are lazy?

i believe it's more bad practice than just intentional lazyness Smile
Post 26 Mar 2007, 12:12
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
m



Joined: 28 Dec 2006
Posts: 304
Location: in
m
Thanks vid for your advice !

I was expecting other remarks such as:

- Using the classical push ... call method of coding function calls.
- Making your own stack-frames and use EQUs to make them easy for
others.
- Not taking advantage of FAsm-size-checking-facility
- Mixing function calls

please ... comment on them ... as well !
Post 28 Mar 2007, 09:46
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17279
Location: In your JS exploiting you and your system
revolution
m wrote:
I was expecting other remarks such as:

- Using the classical push ... call method of coding function calls.
- Making your own stack-frames and use EQUs to make them easy for
others.
- Not taking advantage of FAsm-size-checking-facility
- Mixing function calls

please ... comment on them ... as well !
Since you already know about these things then perhaps we don't need to spend too much effort to comment on every little thing. I am sure you can improve these without needing us to pick unimportant holes in others coding styles.

My basic advice to everyone is do what makes you feel the most comfortable. If later that proves to have been bad then you will have learned a valuable lesson that you will never forget.

Experience is the best teacher.
Post 28 Mar 2007, 11:14
View user's profile Send private message Visit poster's website Reply with quote
m



Joined: 28 Dec 2006
Posts: 304
Location: in
m
Thanks revolution, for your precious time !

I know I'm acting stupid.

Sorry to bother you !
Post 28 Mar 2007, 11:25
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.