Allegro.cc - Online Community

Allegro.cc Forums » Allegro.cc Comments » Thread locks too soon

This thread is locked; no one can reply to it. rss feed Print
Thread locks too soon
Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Peter Hull
Member #1,136
March 2001

type name_array[endindex-startindex+1];
type* name = &name_array[-startindex];

I suppose?

Chris Katko
Member #1,881
January 2002
avatar

DanielH said:

Arrays in Pascal

{ name : array[startindex .. endindex] of type; }
a : array[1..20] of integer;
b : array[-10..35] of real;

hah! Arrays in D:

// https://dlang.org/spec/arrays.html
int[] b = p[0..8]; //slices? YEAH. SLICES.

Associated:

// https://dlang.org/spec/hash-map.html
int[string] aa;   // Associative array of ints that are
                  // indexed by string keys.
                  // The KeyType is string.
aa["hello"] = 3;

And I can still write all the way down to assembler and hardware calls, as well as keep all that C++/C#/etc-style static-typing and performance goodness.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Neil Roy
Member #2,229
April 2002
avatar

He's talking about Pascal to C, not C to Pascal. :/

Ah, okay, yeah, I read that wrong. :/

a : array[1..20] of integer;
b : array[-10..35] of real;

int a[19]; Then subtract 1 from whatever index they choose from 1 to 20 in code that references this array.
float b[46]; Add 10 to any index selection so that -10 = 0, 35 = 45, in code that reference this array.

---
“I love you too.” - last words of Wanda Roy

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Niunio
Member #1,975
March 2002
avatar

Last Neil post is quite correct, and the Pascal compiler does just that.

Pascal arrays are an actual data structure. In the old times, first element ("index 0") stored the size of the array so it was possible to check array overflow in runtime; hence why it allowed up to 255/65535 elements per array (similar limitation for old BASIC interpretors too). They did the same with STRING data type.

In modern days it is a bit different, depending on the compiler configuration (i.e. optimization flags, array overflow test on/off, etcetera) it may use just a pointer (like C) or an "struct" that would store size, index type, low index, high index, reference counter and actual data. Yes, more complex than C, but it isn't much slower (if optimized) and it is safer (no accidental data corruption). They do the same with STRING, but they added ANSISTRING that works more like C char*.

-----------------
Current projects: Allegro.pas | MinGRo

Chris Katko
Member #1,881
January 2002
avatar

Yeah but you can't resize those arrays!!!

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Neil Roy
Member #2,229
April 2002
avatar

Yeah but you can't resize those arrays!!!

You can't resize them in C either, well, unless you create a pointer and malloc, but then it's no longer an array.

---
“I love you too.” - last words of Wanda Roy

Chris Katko
Member #1,881
January 2002
avatar

Hmm, good point!

But AFAIK, (baseline) Turbo Pascal has no support for Dynamic Arrays so you have to load pointers yourself.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Neil Roy
Member #2,229
April 2002
avatar

Yay, got a new home for my games. Thanks to Eric for pointing out github for hosting. It's all I need. I like how it operates as I can make changes on my computer then commit them easily. Very nice. New link in my signature.

---
“I love you too.” - last words of Wanda Roy

Chris Katko
Member #1,881
January 2002
avatar

Neil Roy said:

Thanks to Eric for pointing out github for hosting.

You didn't know about github!??!?!?!?!?

Also, if you need private repos, Bitbucket lets you have 5 private repos for free. So you can work on say, your commercial indie game, with cloud backup, without everyone seeing your notes or code.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Eric Johnson
Member #14,841
January 2013
avatar

You didn't know about github!??!?!?!?!?

Neil's referring to GitHub Pages. Does Bitbucket offer anything similar to GitHub Pages?

Chris Katko
Member #1,881
January 2002
avatar

A static website? Apparently, yes.

https://confluence.atlassian.com/bitbucket/publishing-a-website-on-bitbucket-cloud-221449776.html

Apparently, it works with private repos. Which I would think implies supports free accounts.

You can add Javascript, images, and Disqus (::vomit::).

Limitations are:

Quote:

- The system does not issue cookies.

- Server-side scripts or code are not supported. For example, PHP is not available.

- Each page will be cached for 15 minutes. This means your changes won't be visible immediately. You can manually refresh each page in your browser to see the latest version.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Eric Johnson
Member #14,841
January 2013
avatar

That's pretty cool. It has the same limitations as GitHub (static content, so no server-side stuff). I'm not totally sure what they mean by "The system does not issue cookies" though. Does that mean Bitbucket itself will not issue its own cookies on the static site, or that my JavaScript can't create cookies if hosted there?

Also, you can have private repositories on GitHub if you pay for it or if you tell them you're a student (you'll need a student email address for that).

Chris Katko
Member #1,881
January 2002
avatar

Yeah, they're like opposites. Github is pay-for-private. Bitbucket is pay for more concurrent users. I don't know if they even have "public" repos.

But apparently both support websites. And since Bitbucket is private-by-default, that "could" be useful if for some reason you don't want anyone to see something on your website unless you let them.

For years actually, I was using Google Docs to hold all of my "website." I simply hosted an index.html and then linked to Google Documents for my list of projects, my resume, etc. That way I could edit them from anywhere, and easily do WYSIWYG.

For example:

https://docs.google.com/document/d/1OAvEkl9-rrCnJqElhOLO7_c3BK6ofpYkjyyT_KcpzIY

Except I'd put them in HTML files with an embed link, so it wouldn't show any of the edit controls.

But now with Git hosted websites, that may be easier / prettier.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Eric Johnson
Member #14,841
January 2013
avatar

That's pretty slick. Too bad I don't have permission to view it. :P

I used Bitbucket for a short time about two or three years ago specifically for the private repositories. It worked, but I disliked the interface, so I ultimately returned to GitHub. In addition to the regular Git features, GitHub offers issues, projects, and a wiki. Does Bitbucket offer that stuff?

Chris Katko
Member #1,881
January 2002
avatar

Too bad I don't have permission to view it.

LMAO

Try this link:

https://docs.google.com/document/d/1OAvEkl9-rrCnJqElhOLO7_c3BK6ofpYkjyyT_KcpzIY/edit?usp=sharing

I haven't touched these docs since I got a job years ago. :)

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Neil Roy
Member #2,229
April 2002
avatar

You didn't know about github!??!?!?!?!?

Github? What's that? Do they sell hubcaps for car wheels? LMAO Of course I do. I have had an account there for years now, just never really used it except to check out other people's work. I didn't know you could host a website there.

What I like about Github is that you can use their software which will detect changes in your files and then flag the newer ones to be committed and uploaded. Makes maintaining a simple site like I want very easy.

Up until now, been used to using WS_FTP for Windows 95, amazing the software still works! ;)

---
“I love you too.” - last words of Wanda Roy

Eric Johnson
Member #14,841
January 2013
avatar

What's the GitHub desktop software like? I've always just interacted with repositories on GitHub via terminal.

Neil Roy
Member #2,229
April 2002
avatar

It's pretty nice. Didn't take me long to get use to it. You create a new repository with it, then simply add the files in the folder it creates for your project. It will detect changes and show the changes when you run it. You can then type in a comment about it, click a commit button then push it and voila, it's uploaded. Pretty simple and sweet.

---
“I love you too.” - last words of Wanda Roy

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Chris Katko
Member #1,881
January 2002
avatar

I know this the question, but I've never had a problem just using normal terminal for git and use it for github and bitbucket.

I just press "up" in bash, and it's my compile script. When I'm done, I press up a few more times and it's my commit script.

[edit]

HOLY CRAP. In bitbucket, when you upload a commit with a CHANGE to a BITMAP, you can view:

- before and after side-by-side
- blend them together with a fader control to move between them.
- a split view with a mouse-over line for before and after
- a pixel diff view.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Peter Hull
Member #1,136
March 2001

Just a word about bitbucket - it has unlimited public or private repos for individuals (https://bitbucket.org/product/pricing?tab=host-in-the-cloud), supports mercurial as well as git (if that is important to you, I would use hg wherever I have a choice) and lets you host static websites like github does (https://confluence.atlassian.com/bitbucket/publishing-a-website-on-bitbucket-cloud-221449776.html). Also it has Desktop software (SourceTree) but I do not like it.

Main problem is that everybody else in the world is on github so if you're looking to find collaborators bitbucket isn't so good.

(sorry if this sounds like an advert, normal service will resume momentarily :-/ )

Pete

[edit] most of this has been said already :-X . Eric - the interface has changed recently so might be worth looking again.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Eric Johnson
Member #14,841
January 2013
avatar

Eric - the interface has changed recently so might be worth looking again.

It definitely looks like it's improved since the last time I saw it. I'm going to stick with GitHub though. I'm already comfortable there, plus I have their "Developer" plan, so I already have private repositories, too.



Go to: