kill
for some reason I think?define
s above, don't you? xdPacketKind *decode(uint8_t *buf, size_t len, Error *err);
it could be PacketKind *decode(size_t len, uint8_t *buf[static len], Error *err);
and then the compiler can throw a warning if the buffer is NULL or of wrong lengthPacketKind *decode(size_t len, uint8_t buf[static len], Error *err);
extern "C" {}
does that mean that users of the library form C++ should also do that? What about some pure C headers with all the shiny C only features and then dedicated C++ headers with bunch of #ifdef __cplusplus
extern "C" {}
because otherwise C++ compiler will mangle symbols' names#ifdef __cpluplus
extern "C" {
#endif
blah blah
#ifdef __cpluplus
}
#endif
to not make c++ lib users write this extern thingy each timeuint8_t buf[static len]
trickunpacker_init(Unpacker unpacker[static 1])
instead of unpacker_init(Unpacker *unpacker)
to catch null pointer dereferences at compile time also for the lib users!uint8_t buf[static len]
it doesn't show a warning when the buffer is smallertypedef enum { false, true } bool;
2174cd0
Combine CCollision::IsMover
/CpSpeed
functions as MoverSpeed
- Robyt3
366a8b1
Combine CCollision::GetDTile*
functions as GetDoorTile
- Robyt3
36568ec
Rename CCollision
functions for readability: avoid abbreviations - Robyt3
60693bc
Merge pull request #9363 from Robyt3/Collision-Function-Cleanup - def-#include <iostream>
#include <time.h>
using namespace std;
int main() {
setlocale(LC_ALL, "EN");
srand(time(NULL));
int random = 1 + rand() % 40;
cout << "Random: " << random << endl;
cout << "Launching calculator" << endl;
float a, b, c;
cout << "Enter the 1st number: ";
cin >> a;
cout << "Enter the 2nd number: ";
cin >> b;
char math;
cout << "Enter a mathematical operation (+, -, /, *): ";
cin >> math;
switch (math) {
case '+': c = a + b; break;
case '-': c = a - b; break;
case '*': c = a * b; break;
case '/': c = a / b; break;
default: cout << "Invalid operation"; return 1;
}
cout << "Result: " << c << endl;
return 0;
}
I wrote my calculator in c++, I continue to teach. So the ddnet programming is not far away lolMoz://a
://
was the old logo