Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
Just looking at your code, I think you'll need to look at a few nasties in scan sets: %[^]%a-z] stops at the second ], not the first, for example, and I think your code would misconstrue the %a ...
Answer
#5: Post edited
- Just looking at your code, I think you'll need to look at a few nasties in scan sets:
- * `%[^]%a-z]` stops at the second `]`, not the first, for example, and I think your code would misconstrue the `%a` as a conversion rather than part of the scan set.
- * Likewise `%[]%[a-z]`; the one scan set there stops at the second `]`, but your code would count two scan sets, I believe.
- You also need to know about `%n` (it's a conversion specifier, but it doesn't get counted). You've removed it from the list of conversion specifiers, so you may be OK with that (but your testing should test it).
- You'll need to worry about suppressed conversions `%23*f` (which don't get counted either).
I think your code would accept `%hld` or `%hlu` as valid (whereas `%hhd` and `%llu` are valid — it should be two of the same length modifier). That's one specific case of the more general comment:- You are not validating the format — which is OK, as long as you know that's what you're (not) doing.
- Just looking at your code, I think you'll need to look at a few nasties in scan sets:
- * `%[^]%a-z]` stops at the second `]`, not the first, for example, and I think your code would misconstrue the `%a` as a conversion rather than part of the scan set.
- * Likewise `%[]%[a-z]`; the one scan set there stops at the second `]`, but your code would count two scan sets, I believe.
- You also need to know about `%n` (it's a conversion specifier, but it doesn't get counted). You've removed it from the list of conversion specifiers, so you may be OK with that (but your testing should test it).
- You'll need to worry about suppressed conversions `%23*f` (which don't get counted either).
- I think your code would accept `%hld` or `%lhu` as valid (whereas `%hhd` and `%llu` are valid — it should be two of the same length modifier). That's one specific case of the more general comment:
- You are not validating the format — which is OK, as long as you know that's what you're (not) doing.
#4: Post edited
- Just looking at your code, I think you'll need to look at a few nasties in scan sets:
- * `%[^]%a-z]` stops at the second `]`, not the first, for example, and I think your code would misconstrue the `%a` as a conversion rather than part of the scan set.
- * Likewise `%[]%[a-z]`; the one scan set there stops at the second `]`, but your code would count two scan sets, I believe.
- You also need to know about `%n` (it's a conversion specifier, but it doesn't get counted). You've removed it from the list of conversion specifiers, so you may be OK with that (but your testing should test it).
- You'll need to worry about suppressed conversions `%23*f` (which don't get counted either).
I think your code would accept `%hld` or `%hlu` as valid (whereas `%hhd` and `%llu` are valid — it should be two of the same length modifier).- You are not validating the format — which is OK, as long as you know that's what you're (not) doing.
- Just looking at your code, I think you'll need to look at a few nasties in scan sets:
- * `%[^]%a-z]` stops at the second `]`, not the first, for example, and I think your code would misconstrue the `%a` as a conversion rather than part of the scan set.
- * Likewise `%[]%[a-z]`; the one scan set there stops at the second `]`, but your code would count two scan sets, I believe.
- You also need to know about `%n` (it's a conversion specifier, but it doesn't get counted). You've removed it from the list of conversion specifiers, so you may be OK with that (but your testing should test it).
- You'll need to worry about suppressed conversions `%23*f` (which don't get counted either).
- I think your code would accept `%hld` or `%hlu` as valid (whereas `%hhd` and `%llu` are valid — it should be two of the same length modifier). That's one specific case of the more general comment:
- You are not validating the format — which is OK, as long as you know that's what you're (not) doing.
#3: Post edited
- Just looking at your code, I think you'll need to look at a few nasties in scan sets:
- * `%[^]%a-z]` stops at the second `]`, not the first, for example, and I think your code would misconstrue the `%a` as a conversion rather than part of the scan set.
- * Likewise `%[]%[a-z]`; the one scan set there stops at the second `]`, but your code would count two scan sets, I believe.
- You also need to know about `%n` (it's a conversion specifier, but it doesn't get counted). You've removed it from the list of conversion specifiers, so you may be OK with that (but your testing should test it).
- You'll need to worry about suppressed conversions `%23*f` (which don't get counted either).
- You are not validating the format — which is OK, as long as you know that's what you're (not) doing.
- Just looking at your code, I think you'll need to look at a few nasties in scan sets:
- * `%[^]%a-z]` stops at the second `]`, not the first, for example, and I think your code would misconstrue the `%a` as a conversion rather than part of the scan set.
- * Likewise `%[]%[a-z]`; the one scan set there stops at the second `]`, but your code would count two scan sets, I believe.
- You also need to know about `%n` (it's a conversion specifier, but it doesn't get counted). You've removed it from the list of conversion specifiers, so you may be OK with that (but your testing should test it).
- You'll need to worry about suppressed conversions `%23*f` (which don't get counted either).
- I think your code would accept `%hld` or `%hlu` as valid (whereas `%hhd` and `%llu` are valid — it should be two of the same length modifier).
- You are not validating the format — which is OK, as long as you know that's what you're (not) doing.
#2: Post edited
- Just looking at your code, I think you'll need to look at a few nasties in scan sets:
- * `%[^]%a-z]` stops at the second `]`, not the first, for example, and I think your code would misconstrue the `%a` as a conversion rather than part of the scan set.
* Likewise `%[]%[%a-z]`; the one scan set there stops at the second `]`, but your code would count two scan sets, I believe.- You also need to know about `%n` (it's a conversion specifier, but it doesn't get counted). You've removed it from the list of conversion specifiers, so you may be OK with that (but your testing should test it).
- You'll need to worry about suppressed conversions `%23*f` (which don't get counted either).
- You are not validating the format — which is OK, as long as you know that's what you're (not) doing.
- Just looking at your code, I think you'll need to look at a few nasties in scan sets:
- * `%[^]%a-z]` stops at the second `]`, not the first, for example, and I think your code would misconstrue the `%a` as a conversion rather than part of the scan set.
- * Likewise `%[]%[a-z]`; the one scan set there stops at the second `]`, but your code would count two scan sets, I believe.
- You also need to know about `%n` (it's a conversion specifier, but it doesn't get counted). You've removed it from the list of conversion specifiers, so you may be OK with that (but your testing should test it).
- You'll need to worry about suppressed conversions `%23*f` (which don't get counted either).
- You are not validating the format — which is OK, as long as you know that's what you're (not) doing.
#1: Initial revision
Just looking at your code, I think you'll need to look at a few nasties in scan sets: * `%[^]%a-z]` stops at the second `]`, not the first, for example, and I think your code would misconstrue the `%a` as a conversion rather than part of the scan set. * Likewise `%[]%[%a-z]`; the one scan set there stops at the second `]`, but your code would count two scan sets, I believe. You also need to know about `%n` (it's a conversion specifier, but it doesn't get counted). You've removed it from the list of conversion specifiers, so you may be OK with that (but your testing should test it). You'll need to worry about suppressed conversions `%23*f` (which don't get counted either). You are not validating the format — which is OK, as long as you know that's what you're (not) doing.