Welcome, Guest. Please login or register.

Author Topic: Counting on AllocVec's size memo..  (Read 13643 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show all replies
    • http://koft.net
Re: Counting on AllocVec's size memo..
« on: December 22, 2006, 02:12:11 PM »
OS4 broke it.

AmigaOS 2.0 to 3.9 and MorphOS have the size at -4.

[EDIT] Oh dear, this really is me, Piru.

Wayne: What the heck is going on? :-) [/EDIT]
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show all replies
    • http://koft.net
Re: Counting on AllocVec's size memo..
« Reply #1 on: December 22, 2006, 02:24:17 PM »
Dang it, too bad Piru noticed his session was screwed up, I almost got to look like I know what i'm talking about for once (:
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show all replies
    • http://koft.net
Re: Counting on AllocVec's size memo..
« Reply #2 on: December 22, 2006, 02:26:50 PM »
bytes.

(and again this was Piru)
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show all replies
    • http://koft.net
Re: Counting on AllocVec's size memo..
« Reply #3 on: January 09, 2007, 10:32:02 PM »
I still can't get used to that leading '{' on its own line. Am I defective? Why do people do this?
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show all replies
    • http://koft.net
Re: Counting on AllocVec's size memo..
« Reply #4 on: January 09, 2007, 11:09:34 PM »
Quote

Piru wrote:
Wikipedia: Indent Style#BSD/Allman style

Basically it's easier to read: More "spacious" and it's easier to see where blocks start and end (just find  visually matching brackets).

This is not the universally superior indent style, but it is fairly common. However, the most important thing is to stay consistent: When you choose a style, stick to it. Don't change styles (at least not within the same project).

See more at Wikipedia: Programming style


I guess I'm in the "BSD/KNF" camp. I guess I need to get used to the Allman style. Allman isn't easier to read to me.... I'm doing a lot of windows stuff right now and its all some perverted allman style. Driving me nuts. Especially allan style with win32 calls with 1000 parameters blocked up on multiple lines.
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show all replies
    • http://koft.net
Re: Counting on AllocVec's size memo..
« Reply #5 on: January 09, 2007, 11:18:03 PM »
Quote

CannonFodder wrote:

Hallelujah I am not alone in this world!

Much better.


you definately are not alone. I hate the single line entry '{' what a waste of space. The indent make it obvious what scope one is in. The trailing '}' is ok, it denotes down scope. Thats all you need.
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show all replies
    • http://koft.net
Re: Counting on AllocVec's size memo..
« Reply #6 on: January 09, 2007, 11:19:49 PM »
Quote

CannonFodder wrote:
Code: [Select]

void MFreeVec( APTR memoryBlock ) {
    if (SysBase->LibNode.lib_Version >= 36) {
        FreeVec(memoryBlock);
    }

    else if (MemoryBlock) {
        unsigned long byteSize;
        unsigned long *data;

        data = (unsigned long*)memoryBlock;
        data--;
        byteSize = *data;
        FreeMem(data, byteSize);
    }
}


Much nicer. ;-)


wow, I can actually read that.
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show all replies
    • http://koft.net
Re: Counting on AllocVec's size memo..
« Reply #7 on: January 09, 2007, 11:21:27 PM »
Quote

CannonFodder wrote:
Code: [Select]

void MFreeVec( APTR memoryBlock ) {
    if (SysBase->LibNode.lib_Version >= 36)
        FreeVec(memoryBlock);
    else if (MemoryBlock) {
        unsigned long byteSize;
        unsigned long *data;

        data = (unsigned long*)memoryBlock;
        data--;
        byteSize = *data;
        FreeMem(data, byteSize);
    }
}



sorry, had to do that.
 

Offline koaftder

  • Hero Member
  • *****
  • Join Date: Apr 2004
  • Posts: 2116
    • Show all replies
    • http://koft.net
Re: Counting on AllocVec's size memo..
« Reply #8 on: January 10, 2007, 12:14:40 AM »
Quote

Piru wrote:
Oh no, yet another holy war... But of course it's a matter of taste....
Except that BSD/Allman is teh bestest!!!1
:-D


Might as well be, everybody is doing it. I'll have to learn to cope.