Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34929 > unrolled thread
| Started by | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| First post | 2016-07-16 22:49 +0000 |
| Last post | 2016-07-17 22:26 +0000 |
| Articles | 6 — 2 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: void Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-16 22:49 +0000
Re: void Steven Simpson <ss@my.domain.invalid> - 2016-07-17 09:21 +0100
Re: void Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-17 18:36 +0000
Re: void Steven Simpson <ss@my.domain.invalid> - 2016-07-17 20:17 +0100
Re: void Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-17 22:15 +0000
Re: void Martin Gregorie <martin@address-in-sig.invalid> - 2016-07-17 22:26 +0000
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2016-07-16 22:49 +0000 |
| Subject | Re: void |
| Message-ID | <nmedlv$6im$1@dont-email.me> |
On Sat, 16 Jul 2016 22:20:20 +0000, Stefan Ram wrote: > On several occassions I have observed that the compiler, javac, > has it's own vocabulary. For example, it uses words like »context« > or »symbol« that might not be used this way in the JLS. > > Another example I encountered today: > > The JLS does not seem to think of »void« as a »type«. It says: > > 8.4.5 Method Result > > The result of a method declaration either declares the type of value > that the method returns (the return type), or uses the keyword void to > indicate that the method does not return a value. > > (end of quotation). > > But for the compiler, it seems to be a »type«: > > Main.java:3: error: 'void' type not allowed here > java.lang.System.out.println( java.lang.System.out.println() ); }} > My guess is that the compiler does that because it has a single error message template, something like %s:%d: error '%s' type not allowed here so the least stupid thing it can use to describe the absence of arguments when they're expected is the work void which, in Java, always means an absence of an argument or return value. This is unlike C, where a function declared as "void free(void ptr)" means that free() takes an untyped pointer and returns an untyped pointer value. BUT note the void as a return value is ambiguous in C because it can also mean that nothing is returned by a function. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
[toc] | [next] | [standalone]
| From | Steven Simpson <ss@my.domain.invalid> |
|---|---|
| Date | 2016-07-17 09:21 +0100 |
| Message-ID | <horr5d-0gq.ln1@s.simpson148.btinternet.com> |
| In reply to | #34929 |
On 16/07/16 23:49, Martin Gregorie wrote: > This is unlike C, where a function declared as "void free(void ptr)" > means that free() takes an untyped pointer and returns an untyped pointer > value. Hmm? You mean "void *free(void *)", surely? > BUT note the void as a return value is ambiguous in C because it > can also mean that nothing is returned by a function. There's no ambiguity; a void return type only ever means that nothing is returned. void* is a different type, related to void mnemonically at best. -- ss at comp dot lancs dot ac dot uk
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2016-07-17 18:36 +0000 |
| Message-ID | <nmgj86$c40$1@dont-email.me> |
| In reply to | #34936 |
On Sun, 17 Jul 2016 09:21:05 +0100, Steven Simpson wrote: > On 16/07/16 23:49, Martin Gregorie wrote: >> This is unlike C, where a function declared as "void free(void ptr)" >> means that free() takes an untyped pointer and returns an untyped >> pointer value. > > Hmm? You mean "void *free(void *)", surely? > The manpage says "void free(void *ptr)". -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
[toc] | [prev] | [next] | [standalone]
| From | Steven Simpson <ss@my.domain.invalid> |
|---|---|
| Date | 2016-07-17 20:17 +0100 |
| Message-ID | <682t5d-f0b.ln1@s.simpson148.btinternet.com> |
| In reply to | #34940 |
On 17/07/16 19:36, Martin Gregorie wrote: > On Sun, 17 Jul 2016 09:21:05 +0100, Steven Simpson wrote: > >> On 16/07/16 23:49, Martin Gregorie wrote: >>> This is unlike C, where a function declared as "void free(void ptr)" >>> means that free() takes an untyped pointer and returns an untyped >>> pointer value. >> Hmm? You mean "void *free(void *)", surely? >> > The manpage says "void free(void *ptr)". I was talking about the function you described as taking and returning an "untyped pointer (value)". -- ss at comp dot lancs dot ac dot uk
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2016-07-17 22:15 +0000 |
| Message-ID | <nmh016$r4i$1@dont-email.me> |
| In reply to | #34944 |
On Sun, 17 Jul 2016 20:17:58 +0100, Steven Simpson wrote: > On 17/07/16 19:36, Martin Gregorie wrote: >> On Sun, 17 Jul 2016 09:21:05 +0100, Steven Simpson wrote: >> >>> On 16/07/16 23:49, Martin Gregorie wrote: >>>> This is unlike C, where a function declared as "void free(void ptr)" >>>> means that free() takes an untyped pointer and returns an untyped >>>> pointer value. >>> Hmm? You mean "void *free(void *)", surely? >>> >> The manpage says "void free(void *ptr)". > > I was talking about the function you described as taking and returning > an "untyped pointer (value)". Which I thought free() did. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2016-07-17 22:26 +0000 |
| Message-ID | <nmh0lp$svt$1@dont-email.me> |
| In reply to | #34945 |
On Sun, 17 Jul 2016 22:15:02 +0000, Martin Gregorie wrote: > On Sun, 17 Jul 2016 20:17:58 +0100, Steven Simpson wrote: > >> On 17/07/16 19:36, Martin Gregorie wrote: >>> On Sun, 17 Jul 2016 09:21:05 +0100, Steven Simpson wrote: >>> >>>> On 16/07/16 23:49, Martin Gregorie wrote: >>>>> This is unlike C, where a function declared as "void free(void ptr)" >>>>> means that free() takes an untyped pointer and returns an untyped >>>>> pointer value. >>>> Hmm? You mean "void *free(void *)", surely? >>>> >>> The manpage says "void free(void *ptr)". >> >> I was talking about the function you described as taking and returning >> an "untyped pointer (value)". > > Which I thought free() did. But was wrong. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web