Копытов Никита Р3219
2 unresolved threads
Гадские тесты не проходились, но теперь-то я разобрался.
Всем обязательно запустить мою программу!
- Last updated by Andrey Zhdanov
1 %define dict_start 0 2 3 %macro colon 2 4 %2: dq dict_start ; Set pointer to the next element Не вижу смысла в добавлении каких-либо проверок в этом макросе. Во-первых, этой программой "неопытный пользователь" пользоваться не будет. Во-вторых, если запустить программу с неверным использованием макроса в words.inc, например таким:
colon "GOOD_KEY_STRING", "BAD_LABEL_STRING" db "6th word", 0
, то программа просто напросто не скомпилируется и укажет на строчку с ошибкой:
nasm -f elf64 -o main.o main.asm main.asm:6: error: label or instruction expected at start of line words.inc:7: ... from macro `colon' defined here make: *** [Makefile:22: main.o] Error 1
Аналогичная ситуация происходит, если:
colon BAD_KEY_NOTSTING, GOOD_LABEL_NOTSTRING db "6th word", 0
asm -f elf64 -o main.o main.asm main.asm:6: error: symbol `BAD_KEY_NOTSTING' not defined words.inc:8: ... from macro `colon' defined here make: *** [Makefile:22: main.o] Error 1
Поэтому, считаю, что встроенного функционала указания на ошибку в данном контексте достаточно, но спасибо за предложение.
- Resolved by Никита Копытов
- Resolved by Никита Копытов
- Resolved by Никита Копытов
- Resolved by Никита Копытов
- Last updated by Andrey Zhdanov
67 jmp .dictionary_preview 68 69 .dictionary_size: mov [dictionary_size], r12 ; Print message about the size of the given dictionary 70 mov rdi, dictionary_size_message 71 call print_string 72 mov rdi, [dictionary_size] 73 call print_uint 74 call print_newline 75 76 .await_input: mov rdi, GREATER_THAN_ASCII ; Print ">" to indicate that the program is waiting for input 77 call print_char 78 79 .read_input: mov byte [input_buffer], 0 ; Clear the first element in the buffer to ensure that an empty string is displayed correctly when read 80 mov rdi, input_buffer ; Await and read input from stdin 81 mov rsi, 255 82 call read_word ; String start pointer is in rax - Resolved by Никита Копытов
@408854 ждём фиксы