Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Petite erreur de doc sur String.create et String.make #2895

Closed
vicuna opened this issue Aug 8, 2001 · 2 comments
Closed

Petite erreur de doc sur String.create et String.make #2895

vicuna opened this issue Aug 8, 2001 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Aug 8, 2001

Original bug ID: 476
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Bonjour,

Une petite erreur dans la doc d'ocaml 3.02. Il y est dit que
String.create n et String.make n c lèvent Invalid_argument si n <=
0. Plus précisemment c'est pour n < 0, String.create 0 et String.make
0 c marchent et renvoient bien une chaîne nulle.

Par ailleurs, j'ai observé un résultat bizarre avec le toplevel :

pochi(mentre):~ [51] ocaml
Objective Caml version 3.02

String.create Sys.max_string_length;;

  • : string = Uncaught exception: Invalid_argument("String.create")
    pochi(mentre):~ [52]

On se retrouve sur le shell. Je pense que c'est dû à l'affichage de la
chaîne résultante qui contient des caractères de contrôle. Mais recevoir
une exception Invalid_argument est bizarre. Je ne sais pas trop si c'est
un bug ou une fonctionnalité. :)

Encore mille merci pour Caml,
Amicalement,
d.

David.Mentre@inria.fr
Opinions expressed here are only mine.

@vicuna
Copy link
Author

vicuna commented Aug 8, 2001

Comment author: administrator

Bonjour David,

Une petite erreur dans la doc d'ocaml 3.02. Il y est dit que
String.create n et String.make n c lèvent Invalid_argument si n <=
0. Plus précisemment c'est pour n < 0, String.create 0 et String.make
0 c marchent et renvoient bien une chaîne nulle.

Exact. Je vais corriger cela.

Par ailleurs, j'ai observé un résultat bizarre avec le toplevel :

pochi(mentre):~ [51] ocaml
Objective Caml version 3.02

String.create Sys.max_string_length;;

  • : string = Uncaught exception: Invalid_argument("String.create")
    pochi(mentre):~ [52]

On se retrouve sur le shell. Je pense que c'est dû à l'affichage de la
chaîne résultante qui contient des caractères de contrôle. Mais recevoir
une exception Invalid_argument est bizarre. Je ne sais pas trop si c'est
un bug ou une fonctionnalité. :)

Non, c'est un bug. Le toplevel appelle String.escaped pour obtenir
une version de la chaîne où les caractères non imprimables sont "échappés".
Si la chaîne est de longueur Sys.max_string_length et contient au
moins un caractère de contrôle, String.escaped essaye de construire
une chaîne de longueur > Sys.max_string_length... Je vais corriger
cela aussi.

Merci pour le rapport de bug.

  • Xavier

@vicuna
Copy link
Author

vicuna commented Aug 8, 2001

Comment author: administrator

Fixed 2001-08-08 by XL.

@vicuna vicuna closed this as completed Aug 8, 2001
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant