065_builtins2.patch 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. --- exercises/065_builtins2.zig 2023-10-03 22:15:22.125574535 +0200
  2. +++ answers/065_builtins2.zig 2023-10-05 20:04:07.136101712 +0200
  3. @@ -58,7 +58,7 @@
  4. // Oops! We cannot leave the 'me' and 'myself' fields
  5. // undefined. Please set them here:
  6. narcissus.me = &narcissus;
  7. - narcissus.??? = ???;
  8. + narcissus.myself = &narcissus;
  9. // This determines a "peer type" from three separate
  10. // references (they just happen to all be the same object).
  11. @@ -70,7 +70,7 @@
  12. //
  13. // The fix for this is very subtle, but it makes a big
  14. // difference!
  15. - const Type2 = narcissus.fetchTheMostBeautifulType();
  16. + const Type2 = Narcissus.fetchTheMostBeautifulType();
  17. // Now we print a pithy statement about Narcissus.
  18. print("A {s} loves all {s}es. ", .{
  19. @@ -109,15 +109,15 @@
  20. // Please complete these 'if' statements so that the field
  21. // name will not be printed if the field is of type 'void'
  22. // (which is a zero-bit type that takes up no space at all!):
  23. - if (fields[0].??? != void) {
  24. + if (fields[0].type != void) {
  25. print(" {s}", .{@typeInfo(Narcissus).Struct.fields[0].name});
  26. }
  27. - if (fields[1].??? != void) {
  28. + if (fields[1].type != void) {
  29. print(" {s}", .{@typeInfo(Narcissus).Struct.fields[1].name});
  30. }
  31. - if (fields[2].??? != void) {
  32. + if (fields[2].type != void) {
  33. print(" {s}", .{@typeInfo(Narcissus).Struct.fields[2].name});
  34. }