Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.raspberry-pi > #25425 > unrolled thread
| Started by | gareth evans <headstone255@yahoo.com> |
|---|---|
| First post | 2021-01-04 11:00 +0000 |
| Last post | 2021-02-12 15:40 +0000 |
| Articles | 20 on this page of 157 — 28 participants |
Back to article view | Back to comp.sys.raspberry-pi
AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-04 11:00 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-04 11:42 +0000
Re: AI and decompilation? Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-04 13:08 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-04 17:51 +0000
Re: AI and decompilation? Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-04 21:57 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-04 22:23 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-04 23:09 +0000
Re: AI and decompilation? Dan Espen <dan1espen@gmail.com> - 2021-01-04 17:50 -0500
Re: AI and decompilation? Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-04 23:00 +0000
Re: AI and decompilation? Peter Flass <peter_flass@yahoo.com> - 2021-01-04 16:59 -0700
Re: AI and decompilation? J. Clarke <jclarke.873638@gmail.com> - 2021-01-04 20:42 -0500
Re: AI and decompilation? Dan Espen <dan1espen@gmail.com> - 2021-01-04 20:59 -0500
Re: AI and decompilation? Dan Espen <dan1espen@gmail.com> - 2021-01-04 20:55 -0500
Re: AI and decompilation? Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-05 10:38 +0000
Re: AI and decompilation? Bob Eager <news0073@eager.cx> - 2021-01-05 12:46 +0000
Re: AI and decompilation? Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-05 13:43 +0000
Re: AI and decompilation? Bob Eager <news0073@eager.cx> - 2021-01-05 14:23 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 15:22 +0000
Re: AI and decompilation? Dan Espen <dan1espen@gmail.com> - 2021-01-05 09:05 -0500
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-05 10:51 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-05 11:52 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 12:06 +0000
Re: AI and decompilation? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2021-01-05 20:12 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 11:45 +0000
Re: AI and decompilation? Peter Flass <peter_flass@yahoo.com> - 2021-01-05 14:25 -0700
Re: AI and decompilation? J. Clarke <jclarke.873638@gmail.com> - 2021-01-04 20:38 -0500
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 11:54 +0000
Re: AI and decompilation? Peter Flass <peter_flass@yahoo.com> - 2021-01-05 14:06 -0700
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 22:52 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-05 10:29 +0000
Re: AI and decompilation? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2021-01-04 11:05 -0500
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-04 17:07 +0000
Re: AI and decompilation? scott@slp53.sl.home (Scott Lurndal) - 2021-01-04 17:52 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-05 10:28 +0000
Re: AI and decompilation? Thomas Koenig <tkoenig@netcologne.de> - 2021-01-05 13:06 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-05 13:41 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 15:30 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-05 16:42 +0000
Re: AI and decompilation? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2021-01-05 20:12 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 20:20 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-05 22:23 +0000
Re: AI and decompilation? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2021-01-06 00:14 +0000
Re: AI and decompilation? Eli the Bearded <*@eli.users.panix.com> - 2021-01-06 02:17 +0000
Re: AI and decompilation? Björn Lundin <b.f.lundin@gmail.com> - 2021-01-08 14:39 +0100
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-08 15:07 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-08 15:56 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-08 15:35 +0000
Re: AI and decompilation? Eli the Bearded <*@eli.users.panix.com> - 2021-01-08 20:02 +0000
Re: AI and decompilation? Björn Lundin <b.f.lundin@gmail.com> - 2021-01-10 15:12 +0100
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-06 09:36 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-06 10:43 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-06 18:09 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-06 18:29 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-06 18:37 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-06 21:03 +0000
Re: AI and decompilation? Björn Lundin <b.f.lundin@gmail.com> - 2021-01-08 14:45 +0100
Re: AI and decompilation? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2021-01-08 18:06 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-08 18:44 +0000
Re: AI and decompilation? A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-09 03:02 +0000
Re: AI and decompilation? A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-09 02:58 +0000
Re: AI and decompilation? Andy Burns <usenet@andyburns.uk> - 2021-01-06 18:35 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-06 18:39 +0000
Re: AI and decompilation? Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-06 19:03 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-06 19:08 +0000
Re: AI and decompilation? Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-06 19:19 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-07 04:07 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-07 12:59 +0000
Re: AI and decompilation? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2021-01-08 21:41 -0500
Re: AI and decompilation? Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-09 12:25 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-09 12:46 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-09 15:49 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-09 18:33 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-09 19:20 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-09 21:05 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-09 23:19 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-10 12:17 +0000
Re: AI and decompilation? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2021-01-09 16:54 -0500
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-09 23:48 +0000
Re: AI and decompilation? A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-10 02:00 +0000
Re: AI and decompilation? druck <news@druck.org.uk> - 2021-01-09 18:36 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-09 19:28 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-10 12:15 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-10 12:33 +0000
Re: AI and decompilation? Andy Burns <usenet@andyburns.uk> - 2021-01-10 13:18 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-10 14:01 +0000
Re: AI and decompilation? TimS <timstreater@greenbee.net> - 2021-01-10 15:14 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-10 13:59 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-10 14:46 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-10 15:34 +0000
Re: AI and decompilation? Andy Burns <usenet@andyburns.uk> - 2021-01-10 15:05 +0000
Re: AI and decompilation? Axel Berger <Spam@Berger-Odenthal.De> - 2021-01-10 17:28 +0100
Re: AI and decompilation? Andy Burns <usenet@andyburns.uk> - 2021-01-11 17:25 +0000
Re: AI and decompilation? TimS <timstreater@greenbee.net> - 2021-01-10 15:13 +0000
Re: AI and decompilation? Andy Burns <usenet@andyburns.uk> - 2021-01-10 15:35 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-10 15:35 +0000
Re: AI and decompilation? TimS <timstreater@greenbee.net> - 2021-01-10 17:23 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-10 18:17 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-11 03:44 +0000
Re: AI and decompilation? TimS <timstreater@greenbee.net> - 2021-01-11 11:00 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-11 03:36 +0000
Re: AI and decompilation? Andy Burns <usenet@andyburns.uk> - 2021-01-06 21:34 +0000
Re: AI and decompilation? druck <news@druck.org.uk> - 2021-01-06 18:37 +0000
Re: AI and decompilation? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2021-01-08 21:09 -0500
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-06 09:32 +0000
Re: AI and decompilation? Björn Lundin <b.f.lundin@gmail.com> - 2021-01-08 14:56 +0100
Re: AI and decompilation? Peter Flass <peter_flass@yahoo.com> - 2021-01-05 14:25 -0700
Re: AI and decompilation? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-01-06 14:17 +0200
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-06 12:42 +0000
Re: AI and decompilation? Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2021-01-06 16:42 +0200
Re: AI and decompilation? "Kerr-Mudd,John" <notsaying@127.0.0.1> - 2021-01-08 09:48 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-08 10:27 +0000
Re: AI and decompilation? usenet@only.tnx (Questor) - 2021-01-08 21:40 +0000
Re: AI and decompilation? Peter Flass <peter_flass@yahoo.com> - 2021-01-05 14:06 -0700
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-05 22:27 +0000
Re: AI and decompilation? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2021-01-06 00:14 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-06 08:25 +0000
Re: AI and decompilation? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2021-01-08 21:52 -0500
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-09 15:37 +0000
Re: AI and decompilation? Peter Flass <peter_flass@yahoo.com> - 2021-01-10 06:40 -0700
Re: AI and decompilation? scott@slp53.sl.home (Scott Lurndal) - 2021-01-06 15:15 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-06 16:09 +0000
Re: AI and decompilation? scott@slp53.sl.home (Scott Lurndal) - 2021-01-06 17:07 +0000
Re: AI and decompilation? Martin Gregorie <martin@mydomain.invalid> - 2021-01-06 17:38 +0000
Re: AI and decompilation? druck <news@druck.org.uk> - 2021-01-05 21:20 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-04 17:47 +0000
Re: AI and decompilation? Dan Espen <dan1espen@gmail.com> - 2021-01-04 14:18 -0500
Re: AI and decompilation? Peter Flass <peter_flass@yahoo.com> - 2021-01-04 16:54 -0700
Re: AI and decompilation? Theo <theom+news@chiark.greenend.org.uk> - 2021-01-04 23:01 +0000
Re: AI and decompilation? Eli the Bearded <*@eli.users.panix.com> - 2021-01-04 20:11 +0000
Re: AI and decompilation? Richard Kettlewell <invalid@invalid.invalid> - 2021-01-05 09:07 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-05 09:47 +0000
Re: AI and decompilation? Richard Kettlewell <invalid@invalid.invalid> - 2021-01-05 11:13 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 12:12 +0000
Re: AI and decompilation? Richard Kettlewell <invalid@invalid.invalid> - 2021-01-05 13:39 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 15:32 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 15:40 +0000
Re: AI and decompilation? scott@slp53.sl.home (Scott Lurndal) - 2021-01-05 16:02 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-05 18:27 +0000
Re: AI and decompilation? Vir Campestris <vir.campestris@invalid.invalid> - 2021-01-05 21:15 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 22:54 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 11:56 +0000
Re: AI and decompilation? A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-05 14:11 +0000
Re: AI and decompilation? Bob Eager <news0073@eager.cx> - 2021-01-05 14:22 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 15:35 +0000
Re: AI and decompilation? Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-05 18:47 +0000
Re: AI and decompilation? Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2021-01-05 20:15 +0000
Re: AI and decompilation? J. Clarke <jclarke.873638@gmail.com> - 2021-01-05 07:32 -0500
Re: AI and decompilation? scott@slp53.sl.home (Scott Lurndal) - 2021-01-05 16:00 +0000
Re: AI and decompilation? Adrian Caspersz <email@here.invalid> - 2021-01-05 11:26 +0000
Re: AI and decompilation? Thomas Koenig <tkoenig@netcologne.de> - 2021-01-05 13:07 +0000
Re: AI and decompilation? The Natural Philosopher <tnp@invalid.invalid> - 2021-01-05 13:42 +0000
Re: AI and decompilation? Eli the Bearded <*@eli.users.panix.com> - 2021-01-05 18:31 +0000
Re: AI and decompilation? "K. Krause" <klemens.krause@gmx.net> - 2021-01-05 16:01 +0100
Re: AI and decompilation? druck <news@druck.org.uk> - 2021-01-05 20:51 +0000
Re: AI and decompilation? gareth evans <headstone255@yahoo.com> - 2021-01-05 22:51 +0000
Re: AI and decompilation? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2021-01-08 22:23 -0500
Re: AI and decompilation? Andy Burns <usenet@andyburns.uk> - 2021-02-12 15:40 +0000
Page 3 of 8 — ← Prev page 1 2 [3] 4 5 6 7 8 Next page →
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2021-01-05 22:23 +0000 |
| Message-ID | <rt2ot3$r81$1@dont-email.me> |
| In reply to | #25499 |
On Tue, 05 Jan 2021 20:20:27 +0000, gareth evans wrote: > On 05/01/2021 20:12, Charlie Gibbs wrote: >> On 2021-01-05, Martin Gregorie <martin@mydomain.invalid> wrote: >> >>> On Tue, 05 Jan 2021 15:30:06 +0000, gareth evans wrote: >>> >>>> That it warrants such an involved explanation is very good reason why >>>> such techniques should be avoided today! :-) >>> >>> Agreed. >>> >>> That sort of thing is so much easier in Java or Algol 68, which both >>> recognise that methods/procedures with the same name but different >>> parameter lists are indeed different pieces of code rather than a >>> stupid mistake. >> >> I avoid that technique - it invites other stupid mistakes. >> >> > +1 > > Why any coder would want a procname with different calling lists is > beyond me. > > To object to having x_procname and y_procname etc suggests a coder is > not focussed on the matter in hand but is religiously adhering to some > irrelevant convention. Its very useful indeed in Java: its often helpful to use the same name with different parameter lists for constructors and also for methods that all do similar jobs, e.g for outputting values from a class its helpful to use the same method name, with different parameter lists say: getValue(String caption, int value); getValue(String caption, double value); getValue(String caption, boolean value); where inventing a set of different method names adds little clarity to the code and about the only likely mistake is to try to use it with an unsupported type of value - which will cause a compilation error as you might expect. Similarly, the ability to something similar in Algol 68, is equally convenient ana, IME anyway, doesn't make the code any more error prone or less readable. In both languages, context selects the appropriate method or proc and using an undefined variation gets you a compilation error, despite Algol 68's tendency to widen numeric values to fit a parameter definition. -- -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | Charlie Gibbs <cgibbs@kltpzyxm.invalid> |
|---|---|
| Date | 2021-01-06 00:14 +0000 |
| Message-ID | <rt2vd82214r@news3.newsguy.com> |
| In reply to | #25507 |
On 2021-01-05, Martin Gregorie <martin@mydomain.invalid> wrote: > On Tue, 05 Jan 2021 20:20:27 +0000, gareth evans wrote: > >> On 05/01/2021 20:12, Charlie Gibbs wrote: >> >>> On 2021-01-05, Martin Gregorie <martin@mydomain.invalid> wrote: >>> >>>> On Tue, 05 Jan 2021 15:30:06 +0000, gareth evans wrote: >>>> >>>>> That it warrants such an involved explanation is very good reason why >>>>> such techniques should be avoided today! :-) >>>> >>>> Agreed. >>>> >>>> That sort of thing is so much easier in Java or Algol 68, which both >>>> recognise that methods/procedures with the same name but different >>>> parameter lists are indeed different pieces of code rather than a >>>> stupid mistake. >>> >>> I avoid that technique - it invites other stupid mistakes. >> >> +1 >> >> Why any coder would want a procname with different calling lists is >> beyond me. >> >> To object to having x_procname and y_procname etc suggests a coder is >> not focussed on the matter in hand but is religiously adhering to some >> irrelevant convention. > > Its very useful indeed in Java: its often helpful to use the same name > with different parameter lists for constructors and also for methods that > all do similar jobs, e.g for outputting values from a class its helpful > to use the same method name, with different parameter lists say: > > getValue(String caption, int value); > getValue(String caption, double value); > getValue(String caption, boolean value); I find it easier to just cast "value" to a consistent type. But then, I'm a hidebound C weenie... -- /~\ Charlie Gibbs | "Some of you may die, \ / <cgibbs@kltpzyxm.invalid> | but it's a sacrifice X I'm really at ac.dekanfrus | I'm willing to make." / \ if you read it the right way. | -- Lord Farquaad (Shrek)
[toc] | [prev] | [next] | [standalone]
| From | Eli the Bearded <*@eli.users.panix.com> |
|---|---|
| Date | 2021-01-06 02:17 +0000 |
| Message-ID | <eli$2101052117@qaz.wtf> |
| In reply to | #25515 |
In comp.sys.raspberry-pi, Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote:
> On 2021-01-05, Martin Gregorie <martin@mydomain.invalid> wrote:
>> Its very useful indeed in Java: its often helpful to use the same name
>> with different parameter lists for constructors and also for methods that
>> all do similar jobs, e.g for outputting values from a class its helpful
>> to use the same method name, with different parameter lists say:
>>
>> getValue(String caption, int value);
>> getValue(String caption, double value);
>> getValue(String caption, boolean value);
Java gets that from C++ doesn't it?
> I find it easier to just cast "value" to a consistent type.
> But then, I'm a hidebound C weenie...
Use a union type with an enum for which value in the value is
the proper one. That can easily expand to new types that are not
easily cast.
enum caption_types {
CAPTION_UNDEF = 0,
CAPTION_INT,
CAPTION_FLOAT,
CAPTION_RETURN
};
struct int_value_t;
struct float_value_t;
struct return_value_t;
typedef struct {
enum caption_types here;
int value;
} int_value_t;
typedef struct {
enum caption_types here;
float value;
} float_value_t;
/* try casting this one to something meaningful... */
typedef struct {
enum caption_types here;
int (*value)();
} return_value_t;
typedef struct {
enum caption_types here;
} id_value_t;
typedef union {
id_value_t id_value;
int_value_t int_value;
float_value_t float_value;
return_value_t return_value;
} compare_value_t;
typedef char String; /* unused here */
int
getCaption(String caption, compare_value_t value)
{
int rv = -1;
if (CAPTION_INT == value.id_value.here) {
rv = value.int_value.value;
}
if (CAPTION_FLOAT == value.id_value.here) {
rv = value.float_value.value;
}
if (CAPTION_RETURN == value.id_value.here) {
/* use the return value of the function provided */
rv = (value.return_value.value)();
}
return rv;
}
Elijah
------
should have used a swtich statement
[toc] | [prev] | [next] | [standalone]
| From | Björn Lundin <b.f.lundin@gmail.com> |
|---|---|
| Date | 2021-01-08 14:39 +0100 |
| Message-ID | <rt9nb9$vch$1@dont-email.me> |
| In reply to | #25517 |
Den 2021-01-06 kl. 03:17, skrev Eli the Bearded: > In comp.sys.raspberry-pi, Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote: >> On 2021-01-05, Martin Gregorie <martin@mydomain.invalid> wrote: >>> Its very useful indeed in Java: its often helpful to use the same name >>> with different parameter lists for constructors and also for methods that >>> all do similar jobs, e.g for outputting values from a class its helpful >>> to use the same method name, with different parameter lists say: >>> >>> getValue(String caption, int value); >>> getValue(String caption, double value); >>> getValue(String caption, boolean value); > > Java gets that from C++ doesn't it? > >> I find it easier to just cast "value" to a consistent type. >> But then, I'm a hidebound C weenie... > > Use a union type with an enum for which value in the value is > the proper one. That can easily expand to new types that are not > easily cast. > easy ? <cut long list of c-statements/> How someone can object to the ease of overloading is just beyond me. -- Björn
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2021-01-08 15:07 +0000 |
| Message-ID | <rt9sga$dqm$3@dont-email.me> |
| In reply to | #25606 |
On 08/01/2021 13:39, Björn Lundin wrote: > Den 2021-01-06 kl. 03:17, skrev Eli the Bearded: >> In comp.sys.raspberry-pi, Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote: >>> On 2021-01-05, Martin Gregorie <martin@mydomain.invalid> wrote: >>>> Its very useful indeed in Java: its often helpful to use the same name >>>> with different parameter lists for constructors and also for methods >>>> that >>>> all do similar jobs, e.g for outputting values from a class its helpful >>>> to use the same method name, with different parameter lists say: >>>> >>>> getValue(String caption, int value); >>>> getValue(String caption, double value); >>>> getValue(String caption, boolean value); >> >> Java gets that from C++ doesn't it? >> >>> I find it easier to just cast "value" to a consistent type. >>> But then, I'm a hidebound C weenie... >> >> Use a union type with an enum for which value in the value is >> the proper one. That can easily expand to new types that are not >> easily cast. >> > > easy ? > <cut long list of c-statements/> > > > How someone can object to the ease of overloading is just beyond me. > > It's very simple. It makes things that behave very differently look exactly the same. which is a recipe for disaster -- “But what a weak barrier is truth when it stands in the way of an hypothesis!” Mary Wollstonecraft
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2021-01-08 15:56 +0000 |
| Message-ID | <rt9vaq$93r$2@dont-email.me> |
| In reply to | #25609 |
On Fri, 08 Jan 2021 15:07:54 +0000, The Natural Philosopher wrote: > It's very simple. It makes things that behave very differently look > exactly the same. > > which is a recipe for disaster If you use overloading that way, you're an idiot or a coder trying to lock in a job for life... To see overloading being used sensibly, look at the TreeMap constructors, the String constructors or String.indexOf() methods in the Java Standard Edition API Specification There are also some good examples of overloading in "A very Informal Introduction to Algol 68", which, by the way, is not only an excellent way to learn A68, but is the only serious programming language manual that has made me laugh out loud in places. -- -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | Ahem A Rivet's Shot <steveo@eircom.net> |
|---|---|
| Date | 2021-01-08 15:35 +0000 |
| Message-ID | <20210108153551.790cc82d7fc2a4d4a222e175@eircom.net> |
| In reply to | #25609 |
On Fri, 8 Jan 2021 15:07:54 +0000 The Natural Philosopher <tnp@invalid.invalid> wrote: > On 08/01/2021 13:39, Björn Lundin wrote: > > How someone can object to the ease of overloading is just beyond me. > > > > > It's very simple. It makes things that behave very differently look > exactly the same. That can be a good thing, used well it simply puts irrelevant detail out of sight, used badly it creates as much confusion as #define ONE 2. -- Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/
[toc] | [prev] | [next] | [standalone]
| From | Eli the Bearded <*@eli.users.panix.com> |
|---|---|
| Date | 2021-01-08 20:02 +0000 |
| Message-ID | <eli$2101081502@qaz.wtf> |
| In reply to | #25606 |
In comp.sys.raspberry-pi, Björn Lundin <b.f.lundin@gmail.com> wrote: > Den 2021-01-06 kl. 03:17, skrev Eli the Bearded: >> Use a union type with an enum for which value in the value is >> the proper one. That can easily expand to new types that are not >> easily cast. > > easy ? > <cut long list of c-statements/> It was a complete example with variable and function declarations. A similar complete example in another language is not likely to be _much_ more concise, unless you count shortening identifiers. > How someone can object to the ease of overloading is just beyond me. Overloading can be a useful thing. I just don't think it is be-all, end-all for the problem space, and I wanted to provide a second way the task could be done in C besides Charlie Gibbs's "easier to just cast" method. I've been doing some Arduino programming recently, and while I'm writing C, it's clearly C++ overall because of the libraries I'm using, some of which are overloading stuff. One of those does things I find awkward because it tries to invoke the int method at times I don't want. Eg it wants zero to be the ASCII zero instead of ASCII null unless I write it as "byte(0)". Elijah ------ has been tempted to rewrite the library
[toc] | [prev] | [next] | [standalone]
| From | Björn Lundin <b.f.lundin@gmail.com> |
|---|---|
| Date | 2021-01-10 15:12 +0100 |
| Message-ID | <rtf1vn$ivj$1@dont-email.me> |
| In reply to | #25620 |
Den 2021-01-08 kl. 21:02, skrev Eli the Bearded:
> I've been doing some Arduino programming recently, and while I'm writing
> C, it's clearly C++ overall because of the libraries I'm using, some of
> which are overloading stuff.
And the compiler used is g++.
So yes it is a kind of c++
> One of those does things I find awkward
> because it tries to invoke the int method at times I don't want. Eg
> it wants zero to be the ASCII zero instead of ASCII null unless I write
> it as "byte(0)".
And that is of course since you are not used o a (more) strongly typed
language. But in the end - it is much better to fight the compiler than
to work with the debugger. Strongly typed and successful compilation
usually means correct execution.
But with strongly typed I do not mean c++ and Java - they are strong typed.
Strongly - that is Ada - is where you can have numeric ranges like
type latitude_type is new Float range -90.0 .. 90.0;
type longitude_type is new Float range -180.0 .. 180.0;
type country_type is (dk,uk,se,de,it,bu,sa,...);
and get compile time error for the following
function Where_Am_I(longitude : longitude_type;
latitude : latitude_type) return Country_Type;
longitude : longitude_type := 42.0;
latitude : latitude_type := 25.0;
country : country_type;
in a not strongly types language
country := Where_Am_I(latitude, longitude);
would pass - even if arguments are reversed and, even worse - return
sa (saudi arabia). which is just plain wrong compared to the declarations.
In a strongly types language - the compiler would say no - you pass in
the wrong types compared to the definition.
a correct call
country := Where_Am_I(longitude,latitude);
will return bu (Bulgaria)
The compiler would save you from
* disaster if this was a plane and the code was about the destination
and length there and how much fuel to put in.
* it protects you against badly written unit tests where swapping
coordinates would yield the same country
* it makes it NOT to go to production
* It makes it unnecessary to spend hours or days in the debugger.
In short - a very strongly typed language is your best friend when
programming anything having more than 1_000_000 locs.
without it - it becomes a nightmare to maintain.
--
Björn
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2021-01-06 09:36 +0000 |
| Message-ID | <rt40ab$s1i$1@dont-email.me> |
| In reply to | #25507 |
On 05/01/2021 22:23, Martin Gregorie wrote: > In both languages, context selects the appropriate method Until it doesn't. A day wasted debugging JavaScript to ascertain why IE was totally different to Firefox. There was an implicit cast happening in IE which wasn't in Firefox that turned a 1 into a "1".. Context dependency just adds another layer of complexity and a source of more bugs -- A lie can travel halfway around the world while the truth is putting on its shoes.
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2021-01-06 10:43 +0000 |
| Message-ID | <rt448u$93k$2@dont-email.me> |
| In reply to | #25522 |
On Wed, 06 Jan 2021 09:36:10 +0000, The Natural Philosopher wrote: > On 05/01/2021 22:23, Martin Gregorie wrote: >> In both languages, context selects the appropriate method > > Until it doesn't. > > A day wasted debugging JavaScript to ascertain why IE was totally > different to Firefox. > > There was an implicit cast happening in IE which wasn't in Firefox that > turned a 1 into a "1".. > > Context dependency just adds another layer of complexity and a source of > more bugs ... well, if you use crappy interpreted languages with untyped variables then you've chosen to accept that sort of thing as normal. I much prefer strongly typed languages, so the only language I use that isn't strongly typed is the bash shell script. -- -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2021-01-06 18:09 +0000 |
| Message-ID | <rt4ubu$rtd$1@dont-email.me> |
| In reply to | #25527 |
On 06/01/2021 10:43, Martin Gregorie wrote: > On Wed, 06 Jan 2021 09:36:10 +0000, The Natural Philosopher wrote: > >> On 05/01/2021 22:23, Martin Gregorie wrote: >>> In both languages, context selects the appropriate method >> >> Until it doesn't. >> >> A day wasted debugging JavaScript to ascertain why IE was totally >> different to Firefox. >> >> There was an implicit cast happening in IE which wasn't in Firefox that >> turned a 1 into a "1".. >> >> Context dependency just adds another layer of complexity and a source of >> more bugs > > ... well, if you use crappy interpreted languages with untyped variables > then you've chosen to accept that sort of thing as normal. > Sadly javaScript is all you get in a browser > I much prefer strongly typed languages, so the only language I use that > isn't strongly typed is the bash shell script. > > So do I. > -- If I had all the money I've spent on drink... ..I'd spend it on drink. Sir Henry (at Rawlinson's End)
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2021-01-06 18:29 +0000 |
| Message-ID | <rt4vid$quk$1@dont-email.me> |
| In reply to | #25557 |
On Wed, 06 Jan 2021 18:09:02 +0000, The Natural Philosopher wrote: > On 06/01/2021 10:43, Martin Gregorie wrote: >> On Wed, 06 Jan 2021 09:36:10 +0000, The Natural Philosopher wrote: >> >>> On 05/01/2021 22:23, Martin Gregorie wrote: >>>> In both languages, context selects the appropriate method >>> >>> Until it doesn't. >>> >>> A day wasted debugging JavaScript to ascertain why IE was totally >>> different to Firefox. >>> >>> There was an implicit cast happening in IE which wasn't in Firefox >>> that turned a 1 into a "1".. >>> >>> Context dependency just adds another layer of complexity and a source >>> of more bugs >> >> ... well, if you use crappy interpreted languages with untyped >> variables then you've chosen to accept that sort of thing as normal. >> > Sadly javaScript is all you get in a browser > Fair comment. So far when I've needed dynamic web pages, which isn't often, PHP has done everything I've needed. -- -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2021-01-06 18:37 +0000 |
| Message-ID | <rt501t$8qu$2@dont-email.me> |
| In reply to | #25558 |
On 06/01/2021 18:29, Martin Gregorie wrote: > On Wed, 06 Jan 2021 18:09:02 +0000, The Natural Philosopher wrote: > >> On 06/01/2021 10:43, Martin Gregorie wrote: >>> On Wed, 06 Jan 2021 09:36:10 +0000, The Natural Philosopher wrote: >>> >>>> On 05/01/2021 22:23, Martin Gregorie wrote: >>>>> In both languages, context selects the appropriate method >>>> >>>> Until it doesn't. >>>> >>>> A day wasted debugging JavaScript to ascertain why IE was totally >>>> different to Firefox. >>>> >>>> There was an implicit cast happening in IE which wasn't in Firefox >>>> that turned a 1 into a "1".. >>>> >>>> Context dependency just adds another layer of complexity and a source >>>> of more bugs >>> >>> ... well, if you use crappy interpreted languages with untyped >>> variables then you've chosen to accept that sort of thing as normal. >>> >> Sadly javaScript is all you get in a browser >> > Fair comment. So far when I've needed dynamic web pages, which isn't > often, PHP has done everything I've needed. > > Php is fine server side, but to get speed with a decent interactive page you need JavaScript in the browser, even if its just Ajax. -- The New Left are the people they warned you about.
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@mydomain.invalid> |
|---|---|
| Date | 2021-01-06 21:03 +0000 |
| Message-ID | <rt58jn$quk$3@dont-email.me> |
| In reply to | #25561 |
On Wed, 06 Jan 2021 18:37:49 +0000, The Natural Philosopher wrote: > On 06/01/2021 18:29, Martin Gregorie wrote: >> On Wed, 06 Jan 2021 18:09:02 +0000, The Natural Philosopher wrote: >> >>> On 06/01/2021 10:43, Martin Gregorie wrote: >>>> On Wed, 06 Jan 2021 09:36:10 +0000, The Natural Philosopher wrote: >>>> >>>>> On 05/01/2021 22:23, Martin Gregorie wrote: >>>>>> In both languages, context selects the appropriate method >>>>> >>>>> Until it doesn't. >>>>> >>>>> A day wasted debugging JavaScript to ascertain why IE was totally >>>>> different to Firefox. >>>>> >>>>> There was an implicit cast happening in IE which wasn't in Firefox >>>>> that turned a 1 into a "1".. >>>>> >>>>> Context dependency just adds another layer of complexity and a >>>>> source of more bugs >>>> >>>> ... well, if you use crappy interpreted languages with untyped >>>> variables then you've chosen to accept that sort of thing as normal. >>>> >>> Sadly javaScript is all you get in a browser >>> >> Fair comment. So far when I've needed dynamic web pages, which isn't >> often, PHP has done everything I've needed. >> >> > Php is fine server side, but to get speed with a decent interactive page > you need JavaScript in the browser, even if its just Ajax. The last time, maybe six months ago, that I needed to use a PHP script was to grab data input through a form on the associated web page, reformat it into a fixed format e-mail and send that via my MTA to a chunk of JAVA that builds requested data files and e-mails them back to the requester. This turned out to be fairly simple once I'd thought up a reasonably bullet-proof way to sanitise the input sufficiently to keep trolls, scammers and other nuisances out without inconveniencing genuine users. -- -- Martin | martin at Gregorie | gregorie dot org
[toc] | [prev] | [next] | [standalone]
| From | Björn Lundin <b.f.lundin@gmail.com> |
|---|---|
| Date | 2021-01-08 14:45 +0100 |
| Message-ID | <rt9nml$5jv$1@dont-email.me> |
| In reply to | #25561 |
Den 2021-01-06 kl. 19:37, skrev The Natural Philosopher: >>> >> Fair comment. So far when I've needed dynamic web pages, which isn't >> often, PHP has done everything I've needed. >> >> > Php is fine server side, but to get speed with a decent interactive page > you need JavaScript in the browser, even if its just Ajax. > an language that needs * 'loose comparison' == * 'strict comparison' === with accompanying truth tables that are not-so-obvious is just a bad joke. <https://www.php.net/manual/en/types.comparisons.php> true == 0 -> false true === 0 -> false true == 1 -> true true === 1 -> false WTF? -- Björn
[toc] | [prev] | [next] | [standalone]
| From | Charlie Gibbs <cgibbs@kltpzyxm.invalid> |
|---|---|
| Date | 2021-01-08 18:06 +0000 |
| Message-ID | <rta6u80bl8@news2.newsguy.com> |
| In reply to | #25607 |
On 2021-01-08, Björn Lundin <b.f.lundin@gmail.com> wrote: > Den 2021-01-06 kl. 19:37, skrev The Natural Philosopher: > >>> Fair comment. So far when I've needed dynamic web pages, which isn't >>> often, PHP has done everything I've needed. >> >> Php is fine server side, but to get speed with a decent interactive page >> you need JavaScript in the browser, even if its just Ajax. > > an language that needs > * 'loose comparison' == > * 'strict comparison' === > > with accompanying truth tables that are not-so-obvious is just a bad joke. > ><https://www.php.net/manual/en/types.comparisons.php> > > true == 0 -> false > true === 0 -> false > > true == 1 -> true > true === 1 -> false > > WTF? That sounds like a description of one of those bogus programming languages that pops up in humour columns from time to time. One of them proposed an operator meaning "is more equal than" (shades of Animal Farm). -- /~\ Charlie Gibbs | "Some of you may die, \ / <cgibbs@kltpzyxm.invalid> | but it's a sacrifice X I'm really at ac.dekanfrus | I'm willing to make." / \ if you read it the right way. | -- Lord Farquaad (Shrek)
[toc] | [prev] | [next] | [standalone]
| From | Ahem A Rivet's Shot <steveo@eircom.net> |
|---|---|
| Date | 2021-01-08 18:44 +0000 |
| Message-ID | <20210108184444.13fcef0fb7203453156259ee@eircom.net> |
| In reply to | #25618 |
On 8 Jan 2021 18:06:00 GMT Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote: > On 2021-01-08, Björn Lundin <b.f.lundin@gmail.com> wrote: > > > an language that needs > > * 'loose comparison' == Make that value comparison ... > > * 'strict comparison' === ... and value and type comparison > > with accompanying truth tables that are not-so-obvious is just a bad > > joke. > > > ><https://www.php.net/manual/en/types.comparisons.php> > > > > true == 0 -> false Yep 0 is not a true value > > true === 0 -> false Yep 0 is not a boolean > > true == 1 -> true Yep 1 is a true value > > true === 1 -> false Yep 1 is not a boolean > > WTF? Seems fine to me, you just have to understand what it means like any other language construct. > That sounds like a description of one of those bogus programming > languages that pops up in humour columns from time to time. > One of them proposed an operator meaning "is more equal than" > (shades of Animal Farm). Nope just someone who doesn't understand the language and wants to complain. -- Steve O'Hara-Smith | Directable Mirror Arrays C:\>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. | http://www.sohara.org/
[toc] | [prev] | [next] | [standalone]
| From | A. Dumas <alexandre@dumas.fr.invalid> |
|---|---|
| Date | 2021-01-09 03:02 +0000 |
| Message-ID | <5ff91cd5$0$291$e4fe514c@news.xs4all.nl> |
| In reply to | #25619 |
Ahem A Rivet's Shot <steveo@eircom.net> wrote: > Make that value comparison ... > ... and value and type comparison > Seems fine to me, you just have to understand what it means like > any other language construct. Ah right, you already covered what I said.
[toc] | [prev] | [next] | [standalone]
| From | A. Dumas <alexandre@dumas.fr.invalid> |
|---|---|
| Date | 2021-01-09 02:58 +0000 |
| Message-ID | <5ff91be9$0$287$e4fe514c@news.xs4all.nl> |
| In reply to | #25618 |
Charlie Gibbs <cgibbs@kltpzyxm.invalid> wrote: > On 2021-01-08, Björn Lundin <b.f.lundin@gmail.com> wrote: >> with accompanying truth tables that are not-so-obvious is just a bad joke. >> >> <https://www.php.net/manual/en/types.comparisons.php> >> >> true == 0 -> false >> true === 0 -> false >> >> true == 1 -> true >> true === 1 -> false >> >> WTF? > > That sounds like a description of one of those bogus programming > languages that pops up in humour columns from time to time. > One of them proposed an operator meaning "is more equal than" > (shades of Animal Farm). Looks entirely reasonable to me, once you accept that == means "evaluates to" and === means "is". That can be a useful distinction, and often a necessary one in loosely typed languages.
[toc] | [prev] | [next] | [standalone]
Page 3 of 8 — ← Prev page 1 2 [3] 4 5 6 7 8 Next page →
Back to top | Article view | comp.sys.raspberry-pi
csiph-web