2

Which one is better:

  1. When function read returns an error, the program crashes.
  2. When read function returns an error, the program crashes.
  3. When read-function returns an error, the program crashes.

I'm writing an academic paper.

2
  • This is really a matter of opinion so I am not offering this as an answer but my opinion is that both 1 & 2 are appropriate but need the definite article 'the' including. This should precede the word 'funtion' in 1 and the name of the function in 2. This gives you "when the function read returns an error" and "when the read function returns an error" respectively. The hyphenated version 3 is not really appropriate in most cases.
    – BoldBen
    Nov 16, 2022 at 8:21
  • 1
    You should try using the read function yourself. Read professional style guides from the likes of Apple or Microsoft, and papers by native speakers in the journal you intend to submit your paper to.
    – David
    Nov 16, 2022 at 8:30

2 Answers 2

2

It is more standard to use read() , with or without "[the] function".

"strlcpy and strlcat—Consistent, Safe, String Copy and Concatenation" [[ Miller & Raadt 1999 ]] :

...  
The strlcpy() and strlcat() functions provide a  
consistent, unambiguous API to help the programmer  
write more bullet-proof code.  
...  
Updating older  
code to use strlcpy() and strlcat() should serve to speed  
up some programs and uncover bugs in others.  
...  

It has both with & without "function" , though always after.

"The Linux Programming Interface" [[ Michael Kerrisk 2010 ]] :

...  
The principal topics of this and the next few chapters are the system calls fork(),
exit(), wait(), and execve().  
The fork() system call allows one process, the parent, to create a new process,
the child.  
The exit(status) library function terminates a process  
...  
In the implementation shown in Listing 24-3, the result of func() must be expressed
in the 8 bits that exit() passes from the terminating child to the parent calling wait().  
...

It has both with & without "function" (or Equivalents like [system] call), both before & always after.

In all cases , the "guidelines" seem to be :

Always use "()"
Always use "the" when starting a Sentence or when introducing a function , not when it is a generic function
It is not mandatory to use "function"
When using "function" it can come before or after
Do not use hyphen.

This is a common style guide , the Publisher in your Case may have other in-house suggestions. Use what-ever is necessary or natural.

1

I used to edit and review technical manuals in English and German, and this would often happen in translations into German by an English speaker, or into English by a German speaker. German grammar puts the definition after the type ("function [read]"), while English grammar does it before, often with an article ("the [read] function").

In English, the name would conventionally come before. Your second suggestion looks natural to me (UK English), while the first would lead me to think it had been translated from another language. I've not seen the hyphenated version before, but it looks unusual rather than wrong.

That said, Prem's suggestion and David's comment to check local style guides is worth following.

Not the answer you're looking for? Browse other questions tagged or ask your own question.