* * *

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: Statement as memory barrier for globals ("volatile")
« Last post by kupferstecher on Today at 01:13:32 pm »
"indicates that a value may change between different accesses, even if it does not appear to be modified."
Means the following code line
  writeln(Inttostr(aVolatile)); writeln(Inttostr(aVolatile));
may print two different values.

The volatile concept is clear. But where do you connect it to the writable typed constant? From the language reference:
Quote
2.2 Typed constants
[...]
Contrary to ordinary constants, a value can be assigned to them at run-time. This is an old concept from Turbo Pascal, which has been replaced with support for initialized variables: For a detailed description, see section 4.4, page 223.
[...]
Again where do you see the connection? It doesn't say anything about optimisation, it just says that the constant will behave like a variable.

@ccrause:
The sentence "In FPC, every statement is basically considered to be a compiler-level memory barrier for accesses to global variables." isn't true for current compilers (optimisation is done by the compiler). For target embedded it may be true, but its not documented.
2
General / Re: how to make online game
« Last post by Mr.Madguy on Today at 01:02:26 pm »
@rvk sorry i won't do that again. but i didn't delete it on this topic.
@mr madguy
hi so i managed to create the shape if client connects to the server but i don't know how to send coord for each clients.
let's say there are 5 clients conected to the server. if i send client 1's coord to other clients, how can they know that it's client 1's coord? how can they check if it's client 1?

here are my server and client program
Each client should have some unique ID. This ID is generated via GenerateID method on server and sent in ClientID field of TData. When client sends it's data, it leaves this field empty, as client is identified by connection on server.

I've simplified protocol again in order to simplify code. I always send TData with fixed length, that means excessive traffic in some cases. In real situation sending and receiving data should be performed in two steps: 1) Receive header, that contains some data, that allows code to detect length and structure of following data 2) Receive all other data.

Another thing, that isn't good - the way, send errors are being handled on server. Server simply tries to send all data again on next frame in this case. This may cause dead loop in real situation. Buffer overflow -> send error -> send all data again -> buffer overflow again.

Conclusion - it's just an example. It needs lots of improvements to become real server.
3
Beginners / Re: Update / Delete from text file
« Last post by molly on Today at 12:59:16 pm »
:'( So as I understand I should do it like this:
Basically yes.

Another option (at least for removal) is to have a status field for each record, and mark a entry for deletion so that you can 'skip' that record (and re-use the record amrked for deletion when adding records).

However, this add a fair amount of complexity especially when you also want to have an ascending record ID without skipping number ID's. In that case it would probably be easier to just use an already existing database solution.
4
General / Re: Statement as memory barrier for globals ("volatile")
« Last post by Thaddy on Today at 12:55:49 pm »
I am quite sure Jonas will to some extend support my explanation.
The difficulty on this forum is always that we have users (often extremely good programmers!) and users that are third grade computer scientists (like me) >:D 8-) O:-)

Funny thing is you did not read that answer carefully:
"The reason the need for volatile on embedded systems is far less in FPC,
is the existence of the "absolute" keyword. In C, you have to declare
all of those memory mapped registers as volatile pointers, because
otherwise things will get optimised wrongly. In FPC, you can declare
them as variables that are "absolute" at some address, and the compiler
will never optimise their accesses. Only if you would take the address
of one of these variables and store it in a pointer, you would need
"volatile" in this context.
"

Dunno what you think, but..... <grin>

Probably overlooked assignable typed constants and mentioned absolute. All covered. < very, very, grumpy  >:D >:D >:D >:D >:D>
5
General / Re: Bitcoin Address Generator in Pascal?
« Last post by Rekumkacz on Today at 12:53:17 pm »
 >:( before:
Quote
  //Convert String to byte array
  for i := 0 to (length(sinput) div 2)-1 do
   boutput:= StrToInt('$'+copy(sinput,i*2+1,2));
after:
Quote
  //Convert String to byte array
  for i := 0 to (length(sinput) div 2)-1 do
    binput:= StrToInt('$'+copy(sinput,i*2+1,2));

https://www.youtube.com/watch?v=PH0DvEuKf_s
6
General / Re: Statement as memory barrier for globals ("volatile")
« Last post by ccrause on Today at 12:52:30 pm »
Volatile has been debated in the past, see e.g. this thread. This reply by Jonas to another thread suggests that (at least in 2015) in FPC there isn't a full equivalent of "volatile".  From Jonas's reply it appears that the use of the "absolute" keyword implies the compiler "will never optimize their accesses".  Also Jonas stated the following: "In FPC, every statement is basically considered to be a compiler-level memory barrier for accesses to global variables."
7
General / Re: Statement as memory barrier for globals ("volatile")
« Last post by Thaddy on Today at 12:41:55 pm »
"In computer programming, particularly in the C, C++, C#, and Java programming languages, the volatile keyword indicates that a value may change between different accesses, even if it does not appear to be modified. This keyword prevents an optimizing compiler from optimizing away subsequent reads or writes and thus incorrectly reusing a stale value or omitting writes."

Which is EXACTLY the same as an assignable typed const behaves.

I rest my plea... Back to school as far as I am concerned.
8
FPC development / Re: FPC 3.0.4 release
« Last post by Thaddy on Today at 12:39:26 pm »
I am not sure about that any more. Lack of time and/or motivation now delays the release. It is understandable in a FOSS project but causes a real problem nevertheless.
Now the problem got emphasized because Lazarus project decided to release version 1.8 with FPC 3.0.4. It was a reasonable decision because 3.0.4 fixes some serious bugs and it was expected to be out already.
I would like to see Lazarus 1.8 release before Christmas which is ~1 month from now. It means FPC 3.0.4 should be released within 3 weeks. Will it happen?

This is a serious problem also because the project is so popular. If it had 10 or 20 geek users, everybody could build from source and be happy.
Now it has tens of thousands of users. Releases are important!

we are waiting for 3.0.4 dmgs files for mac, I will ask for this again.
Maciej, this was discussed a couple of weeks ago (at a meeting) and seems the reason there is no release yet.
9
FPC development / Re: FPC 3.0.4 release
« Last post by hnb on Today at 12:34:22 pm »
I am not sure about that any more. Lack of time and/or motivation now delays the release. It is understandable in a FOSS project but causes a real problem nevertheless.
Now the problem got emphasized because Lazarus project decided to release version 1.8 with FPC 3.0.4. It was a reasonable decision because 3.0.4 fixes some serious bugs and it was expected to be out already.
I would like to see Lazarus 1.8 release before Christmas which is ~1 month from now. It means FPC 3.0.4 should be released within 3 weeks. Will it happen?

This is a serious problem also because the project is so popular. If it had 10 or 20 geek users, everybody could build from source and be happy.
Now it has tens of thousands of users. Releases are important!

we are waiting for 3.0.4 dmgs files for mac, I will ask for this again.
10
IDE/CodeTools / Inline Evaluation Plugin
« Last post by AlbertHosteen on Today at 12:34:17 pm »
Hello,
Im dont understand much much the "wheels and levers" within the Lazarus project, but could it be possible to create plugin for an inline evaluation directly in the editor?
As in this project for Delphi: https://github.com/lynatan/DLight
Pages: [1] 2 3 ... 10

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus