Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-18 Thread Bart
On 11/16/11, Tomas Hajny wrote: > Indeed - TP/BP 7.0 gives the same (error) result. Unit strings (which > might be more appropriate than unit objects included by Bart) doesn't > change the result either. Getting really Off-Topic ;-) PChar is defined in objects unit in TP6, there is no strings un

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Tomas Hajny
On 16 Nov 11, at 21:53, Bart wrote: > On 11/16/11, Jonas Maebe wrote: > > > Again: length(pchar) is perfectly correct and will be translated into > > strlen(pchar), just like in Delphi (and probably even like in TP). > > Couldn't resist; > > Turbo Pascal 6.0: > > Program Prog; > > uses object

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Bart
On 11/16/11, Jonas Maebe wrote: > Again: length(pchar) is perfectly correct and will be translated into > strlen(pchar), just like in Delphi (and probably even like in TP). Couldn't resist; Turbo Pascal 6.0: Program Prog; uses objects; var pc: PChar; Len: Integer; begin Len := Length(p

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Sven Barth
Am 16.11.2011 17:25, schrieb Jonas Maebe: On 16 Nov 2011, at 17:15, Sven Barth wrote: Am 16.11.2011 16:55, schrieb Rainer Stratmann: But when having pchar I wonder why it generally is not possible to make strings longer than 255 as it was possible in the previous compiler version. There was

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Sven Barth
Am 16.11.2011 17:25, schrieb Jonas Maebe: On 16 Nov 2011, at 17:15, Sven Barth wrote: Am 16.11.2011 16:55, schrieb Rainer Stratmann: But when having pchar I wonder why it generally is not possible to make strings longer than 255 as it was possible in the previous compiler version. There was

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Jonas Maebe
On 16 Nov 2011, at 17:15, Sven Barth wrote: Am 16.11.2011 16:55, schrieb Rainer Stratmann: But when having pchar I wonder why it generally is not possible to make strings longer than 255 as it was possible in the previous compiler version. There was never a change regarding this as far as

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Sven Barth
Am 16.11.2011 16:55, schrieb Rainer Stratmann: But when having pchar I wonder why it generally is not possible to make strings longer than 255 as it was possible in the previous compiler version. There was never a change regarding this as far as I know. For shortsting I accept strings not lo

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Jonas Maebe
On 16 Nov 2011, at 17:06, Martin wrote: So why not use pos(#0, foo_pchar) ? That will convert foo_pchar to a string type (which one probably depends on the state of the {$h} switch) and then call pos() on it. Again: length(pchar) is perfectly correct and will be translated into strlen(

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Martin
On 16/11/2011 16:06, Martin wrote: As mentioned before by someone else: length does read a field from the string, which does not exist in pchar (hence string can contain #0 and pchar can not). Ok, before someone comments on this: pchar can contain #0 but for automatic string conversation t

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Sven Barth
Am 16.11.2011 17:06, schrieb Martin: As mentioned before by someone else: length does read a field from the string, which does not exist in pchar (hence string can contain #0 and pchar can not). Jonas mentioned in another mail in this thread (as an answer to Felipe) that "Length(PChar)" is con

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Martin
On 16/11/2011 15:55, Rainer Stratmann wrote: -Sh- Is the same as {$h-} or {$longstrings off}. You need -Sh (provided that there's no {$mode fpc/objfpc/tp/macpas} in the source file, since that will disable them again). With {$h+} it works. But when having pchar I wonder why it generally is not p

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread michael . vancanneyt
On Wed, 16 Nov 2011, Rainer Stratmann wrote: Am Monday 14 November 2011 22:00:28 schrieb Jonas Maebe: On 13 Nov 2011, at 14:02, Rainer Stratmann wrote: Am Sunday 13 November 2011 02:15:07 schrieb leledumbo: It works when {$LONGSTRINGS ON} or {$H+} directive exists. I think the compiler trea

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-16 Thread Rainer Stratmann
Am Monday 14 November 2011 22:00:28 schrieb Jonas Maebe: > On 13 Nov 2011, at 14:02, Rainer Stratmann wrote: > > Am Sunday 13 November 2011 02:15:07 schrieb leledumbo: > >> It works when {$LONGSTRINGS ON} or {$H+} directive exists. I think the > >> compiler treats functions receiving array of char

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-15 Thread Sven Barth
Am 15.11.2011 10:39, schrieb Graeme Geldenhuys: On 15/11/2011, Sven Barth wrote: In this case the reason is simply backwards compatibilty (note: not Delphi compatibilty :P ). But that's my point. I really don't think anybody is writing TP style programs any more. So wouldn't it make sense to

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-15 Thread Graeme Geldenhuys
On 15/11/2011, Sven Barth wrote: > In this case the reason is simply backwards compatibilty (note: not Delphi > compatibilty :P ). But that's my point. I really don't think anybody is writing TP style programs any more. So wouldn't it make sense to change the default for the vast majority or pro

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-15 Thread Sven Barth
Am 13.11.2011 17:49, schrieb Graeme Geldenhuys: On 13/11/2011, leledumbo wrote: I think the compiler treats functions receiving array of char (or pointer to it) as ShortString when none of the directives above exist. Indeed, FPC defaults to ShortString if {$H+} is not specified. That is proba

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-14 Thread Jonas Maebe
On 13 Nov 2011, at 14:02, Rainer Stratmann wrote: > Am Sunday 13 November 2011 02:15:07 schrieb leledumbo: >> It works when {$LONGSTRINGS ON} or {$H+} directive exists. I think the >> compiler treats functions receiving array of char (or pointer to it) as >> ShortString when none of the directive

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-14 Thread Graeme Geldenhuys
On 13/11/2011, leledumbo wrote: > I think the > compiler treats functions receiving array of char (or pointer to it) as > ShortString when none of the directives above exist. Indeed, FPC defaults to ShortString if {$H+} is not specified. That is probably the problem. I really don't know why this

Re: [fpc-pascal] Re: pchar with more than 255 characters

2011-11-14 Thread Rainer Stratmann
Am Sunday 13 November 2011 02:15:07 schrieb leledumbo: > It works when {$LONGSTRINGS ON} or {$H+} directive exists. I think the > compiler treats functions receiving array of char (or pointer to it) as > ShortString when none of the directives above exist. No it does not work then. I put already t

[fpc-pascal] Re: pchar with more than 255 characters

2011-11-12 Thread leledumbo
It works when {$LONGSTRINGS ON} or {$H+} directive exists. I think the compiler treats functions receiving array of char (or pointer to it) as ShortString when none of the directives above exist. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/pchar-with-more-tha