Liste des Groupes | Revenir à cl c |
Bart <bc@freeuk.com> writes:Is nothing I write that you will take issue with?
On 07/09/2024 02:44, Waldek Hebisch wrote:Is there no part of C you can't misrepresent?Bart <bc@freeuk.com> wrote:>On 06/09/2024 11:19, Waldek Hebisch wrote:Bart <bc@freeuk.com> wrote:>(You can balance it out by by requiring ASSIGN(&A, &B)!)This would not work in general, as I wrote it, the following are
valid:
assign(&a, 42)
assign(&a, a + 1)
but the second argument has no address, so your variant would not
work.
I believe that C's compound literals can give a reference to a+1:
I suggested a 'assign()' function could have balanced parameters by requiring:#include <stdio.h>This is simply an anonymous object. You could have used a named object
>
void assign(int* lhs, int* rhs) {
*lhs = *rhs;
}
>
int main(void) {
int a=20;
>
assign(&a, &(int){a+1});
and it wold not have been any further from being a "reference to a+1".
Les messages affichés proviennent d'usenet.