[Info-vax] New VSI post on Youtube
    Arne Vajhøj 
    arne at vajhoej.dk
       
    Thu Sep  5 13:30:56 EDT 2024
    
    
  
On 8/14/2024 2:33 PM, Arne Vajhøj wrote:
> And it has different size of long and pointers. Causing problems
> for two cases:
> * code that make implicit assumptions that those are 32 bit
> * mixing C and C++
And in case someone has not seen it:
$ type long.h
#ifdef __cplusplus
extern "C" {
#endif
struct data
{
     long a;
     long b;
     long c;
     long d;
};
#ifdef __cplusplus
}
#endif
$ type long1.cxx
#include "long.h"
extern "C" {
void f(struct data *d);
}
int main()
{
     struct data o;
     o.a = 1;
     o.b = 2;
     o.c = 3;
     o.d = 4;
     f(&o);
     return 0;
}
$ type long2.c
#include <stdio.h>
#include "long.h"
void f(struct data *o)
{
     printf("%ld %ld %ld %ld\n", o->a, o->b, o->c, o->d);
}
$ cxx/name=upper long1
$ cc long2
$ link/exe=long long1 + long2
$ run long
1 0 2 0
Arne
    
    
More information about the Info-vax
mailing list