harec

[hare] Hare compiler, written in C11 for POSIX OSs
Log | Files | Refs | README | LICENSE

strcmp.ha (287B)


      1 export fn strcmp(_a: str, _b: str) bool = {
      2 	if (len(_a) != len(_b)) {
      3 		return false;
      4 	};
      5 	let a = (&_a: *string).data, b = (&_b: *string).data;
      6 	let a = a: *[*]u8, b = b: *[*]u8;
      7 	for (let i = 0z; i < len(_a); i += 1) {
      8 		if (a[i] != b[i]) {
      9 			return false;
     10 		};
     11 	};
     12 	return true;
     13 };