Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Future of C++ Interoperability: Insights fr...

Himeshi
March 22, 2024

The Future of C++ Interoperability: Insights from Porting a Game to Swift

Himeshi

March 22, 2024
Tweet

More Decks by Himeshi

Other Decks in Programming

Transcript

  1. 5 // Updates the way speed limit of the tile

    of the given position void update_speed_limit(coord3d pos, uint16_t speed) { tile_t* tile = world()->get_tile(pos); way_t* way = tile->get_way(); way->set_speed_limit(speed); }
  2. 6 // Updates the way speed limit of the tile

    of the given position void update_speed_limit(coord3d pos, uint16_t speed) { tile_t* tile = world()->get_tile(pos); way_t* way = tile->get_way(); way->set_speed_limit(speed); }
  3. 7 // Updates the way speed limit of the tile

    of the given position void update_speed_limit(coord3d pos, uint16_t speed) { tile_t* tile = world()->get_tile(pos); way_t* way = tile->get_way(); way->set_speed_limit(speed); }
  4. 8 // Updates the way speed limit of the tile

    of the given position void update_speed_limit(coord3d pos, uint16_t speed) { tile_t* tile = world()->get_tile(pos); way_t* way = tile->get_way(); way->set_speed_limit(speed); } /VMM1PJOUFS"DDFTT /VMM1PJOUFS"DDFTT
  5. 9 // Updates the way speed limit of the tile

    of the given position void update_speed_limit(coord3d pos, uint16_t speed) { tile_t* tile = world()->get_tile(pos); if(tile==NULL) { return; } way_t* way = tile->get_way(); if(way==NULL) { return; } way->set_speed_limit(speed); }
  6. 10 // Updates the way speed limit of the tile

    of the given position void update_speed_limit(coord3d pos, uint16_t speed) { tile_t* tile = world()->get_tile(pos); if(tile==NULL) { return; } way_t* way = tile->get_way(); if(way==NULL) { return; } way->set_speed_limit(speed); }
  7. 12

  8. 13 // Updates the way speed limit of the tile

    of the given position func updateSpeedLimit(pos: Coord, speed: UInt) { let tile = world().getTile(pos) let way = tile?.way way?.setSpeedLimit(speed) } 4XJGUTPMWFTOVMMQPJOUFSBDDFTTDSBTI
  9. $ UZQFTBSFFYQPTFEUP4XJGU 16 class CppType { public: int32_t myFunc() const

    { return 42; } }; let cppObj = CppType() let value = cppObj.myFunc()
  10. $ UZQFTBSFFYQPTFEUP4XJGU 17 class CppType { public: int32_t myFunc() const

    { return 42; } }; let cppObj = CppType() let value = cppObj.myFunc()
  11. $ UZQFTBSFFYQPTFEUP4XJGU 18 class CppType { public: int32_t myFunc() const

    { return 42; } }; let cppObj = CppType() let value = cppObj.myFunc()
  12. 4XJGUUZQFTBSFFYQPTFEUP$ 19 public struct MyValueType { public init() { /*

    just make it public */ } public func myFunc() { print("Hello, struct.") } } MyValueType obj = MyValueType::init(); obj.myFunc();
  13. 4XJGUUZQFTBSFFYQPTFEUP$ 20 public struct MyValueType { public init() { /*

    just make it public */ } public func myFunc() { print("Hello, struct.") } } MyValueType obj = MyValueType::init(); obj.myFunc();
  14. 4XJGUUZQFTBSFFYQPTFEUP$ 21 public struct MyValueType { public init() { /*

    just make it public */ } public func myFunc() { print("Hello, struct.") } } MyValueType obj = MyValueType::init(); obj.myFunc();
  15. 22

  16. 26

  17. 35 C vehicle_t virtual func move() C abstract_vehicle_t virtual func

    move() = 0; S RailVehicle mutating func move() var super: vehicle_t
  18. 36 C vehicle_t virtual func move() C abstract_vehicle_t virtual func

    move() = 0; S RailVehicle mutating func move() var super: vehicle_t C wrapped_rail_vehicle_t func move() { innerObject.move(); } RailVehicle innerObject;
  19. 37 C vehicle_t virtual func move() C abstract_vehicle_t virtual func

    move() = 0; S RailVehicle mutating func move() var super: vehicle_t C wrapped_rail_vehicle_t func move() { innerObject.move(); } RailVehicle innerObject;
  20. 38 C vehicle_t virtual func move() S RailVehicle mutating func

    move() var super: vehicle_t C road_vehicle_t func move()
  21. 39 C vehicle_t virtual func move() S RailVehicle mutating func

    move() var super: vehicle_t C road_vehicle_t func move() P Vehicle mutating func move() *OIFSJUT $POGPSNT $POGPSNT
  22. 40 C vehicle_t virtual func move() S RailVehicle mutating func

    move() var super: vehicle_t C road_vehicle_t func move() P Vehicle mutating func move() *OIFSJUT $POGPSNT $POGPSNT