Recent

Author Topic: A suggestion for a new FPC feature  (Read 6922 times)

Handoko

  • Hero Member
  • *****
  • Posts: 3237
  • My goal: build my own game engine using Lazarus
Re: A suggestion for a new FPC feature
« Reply #60 on: July 04, 2019, 01:37:52 pm »
where we can see which highlighters are installed in the forum?

Zoran

  • Hero Member
  • *****
  • Posts: 1468
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: A suggestion for a new FPC feature
« Reply #61 on: July 04, 2019, 01:41:55 pm »

@Handoko, Lucamar wants to know about those not listed in this combo box, but supported.

OffTopic, but ...

Martin, is there some place where we can see which highlighters are installed in the forum?

Let's try a few:
[code=C++]  -- automatically replaced by C
Code: C  [Select]
  1.  

[code=C#]  -- automatically replaced by C
Code: C  [Select]
  1.  

[code=Java] -- suported!
Code: Java  [Select]
  1.  

It seems that "C++" and "C#" are automatically replaced with "C".
On the other hand, "Java" is recognized.

Martin, would you add "Java" to the combobox, please.

Handoko

  • Hero Member
  • *****
  • Posts: 3237
  • My goal: build my own game engine using Lazarus
Re: A suggestion for a new FPC feature
« Reply #62 on: July 04, 2019, 01:44:05 pm »
Oh, I'm sorry. I didn't read the whole thread.

lucamar

  • Hero Member
  • *****
  • Posts: 2144
Re: A suggestion for a new FPC feature
« Reply #63 on: July 04, 2019, 01:57:06 pm »
Oh, I'm sorry. I didn't read the whole thread.

No problem, don't worry.

It's just that this happened another time, only IIRC that time the poster was using [code=pascal] for C code; as is obvious that tends to render most of the code as if it were a comment. Having a place to look for all the valid highlight modifiers would ... maybe not prevent it, but help correct it. And it would be a nice addition to the "Forum" article in the wiki :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.4/2.0.6  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

ASerge

  • Hero Member
  • *****
  • Posts: 1423
Re: A suggestion for a new FPC feature
« Reply #64 on: July 04, 2019, 03:09:17 pm »
Continue offtopic. The assembler is also recognized:
Code: ASM  [Select]
  1. mov  eax, edx
  2. jmp  @@L1 ; Comment


440bx

  • Hero Member
  • *****
  • Posts: 1281
Re: A suggestion for a new FPC feature
« Reply #65 on: July 04, 2019, 03:16:48 pm »
It's just that this happened another time, only IIRC that time the poster was using [code=pascal] for C code; as is obvious that tends to render most of the code as if it were a comment.
I remember that! <chuckle>  at the time, I pointed out that I agreed with you, I didn't know the options in the dropdown did not include all the languages the formatter can handle.  That's why I used Pascal for C.

It's definitely nicer when using the format that is for the target language.
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5790
    • wiki
Re: A suggestion for a new FPC feature
« Reply #66 on: July 04, 2019, 04:08:26 pm »
OffTopic, but ...
Martin, is there some place where we can see which highlighters are installed in the forum?
We have GeSHi installed. ( https://codebirth.com/index.php?topic=81.0 )

The "[Select]" is copied js from IIRC the built-in code.
And some other fine tuning, so copy and paste works from most browsers...

I added asm and Java too. (Though I really do not know why we need the latter)

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
Re: A suggestion for a new FPC feature
« Reply #67 on: July 04, 2019, 04:16:14 pm »
I added asm and Java too. (Though I really do not know why we need the latter)

Android/ppcjvm

Zoran

  • Hero Member
  • *****
  • Posts: 1468
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: A suggestion for a new FPC feature
« Reply #68 on: July 04, 2019, 10:53:03 pm »
I added asm and Java too. (Though I really do not know why we need the latter)

Android/ppcjvm

Or someone might want to show some java code, when asking how to do it in Pascal.
I just assumed that, when any programming language is already supported by forum highlighter, it is good to have it listed there.

OffTopic, but ...
Martin, is there some place where we can see which highlighters are installed in the forum?
We have GeSHi installed. ( https://codebirth.com/index.php?topic=81.0 )

There I found the link to list of supported languages

So, perhaps too many for the combo box, but perhaps this link should be put somewhere.

lucamar

  • Hero Member
  • *****
  • Posts: 2144
Re: A suggestion for a new FPC feature
« Reply #69 on: July 05, 2019, 12:12:21 am »
There I found the link to list of supported languages

So, perhaps too many for the combo box, but perhaps this link should be put somewhere.

I'll add it to that wiki page. Thanks Zoran!

ETA: Done! See: Forum.

I was going to copy/paste the full list but it's too long! Instead I just added the link; we'll see how much time it stays unbroken :)
« Last Edit: July 05, 2019, 12:51:28 am by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.4/2.0.6  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

GAN

  • Full Member
  • ***
  • Posts: 232
Re: A suggestion for a new FPC feature
« Reply #70 on: July 05, 2019, 02:45:33 am »
Starting at an index different than zero can really complicate pointer arithmetic which is quite common in C (and just as common in Pascal depending on what you're doing.)

Well avoiding pointers is hard, because that is the way of C. Even for something as simple as a by reference parameter.

A lot of it would be unnecessary with a mature language, and then also the limitation seems artificial.

Quote
I rarely use a low bound different than zero - even in Pascal - for that very reason.  That way expressions that calculate an offset in memory can directly use the zero based array index to compute displacements instead of adjusting the index by - low(array)

Not daily. Most of my arrays start with zero. But I wouldn't want to be forced to do that. Arrays for subranges of enums are an example.

I use a lot of arrays that starts with one, for example array of months 1..12 it's better than 0..11. Also in arrays that have codes wich starts from 1. It's very usefull.
Lazarus 1.8.4 FPC 3.0.4 Linux Mint Mate 17.2 x86_64 GTK-2
Zeos 7.1.3 - Sqlite 3.8.2

Foro Lazarus en español http://forum.lazarus.freepascal.org/index.php/board,73.0.html

440bx

  • Hero Member
  • *****
  • Posts: 1281
Re: A suggestion for a new FPC feature
« Reply #71 on: July 05, 2019, 03:38:40 am »
I use a lot of arrays that starts with one, for example array of months 1..12 it's better than 0..11. Also in arrays that have codes wich starts from 1. It's very usefull.
No doubt.  There are times when being able to start at something other than zero can be useful and clear.  Keeping track of Months is a good example of that since, by convention, January is month 1 not 0.
using FPC v3.0.4 and Lazarus 1.8.2 on Windows 7 64bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 726
  • Compiler Developer
Re: A suggestion for a new FPC feature
« Reply #72 on: July 05, 2019, 09:40:37 am »
Fine with me. The initialized constant is maybe to ambiguous, since Delphi doesn't do initial local vars.
Hey, we more or less agreed on a language extension! I should probably mark that in a calendar. :P

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7623
Re: A suggestion for a new FPC feature
« Reply #73 on: July 05, 2019, 10:01:58 am »
Fine with me. The initialized constant is maybe to ambiguous, since Delphi doesn't do initial local vars.
Hey, we more or less agreed on a language extension! I should probably mark that in a calendar. :P

One that Delphi doesn't have!.  Sure, just mark 05-07-2024, and remind me it is time for the next one by then  O:-)