-
Jul 21st, 2022, 09:42 AM
#1
Thread Starter
Frenzied Member
Why are some function names prefixed with the letter "n"?
I see some function names in Microsoft's codebases are prefixed with the letter "n" and I wonder why? Thanks!
Code:
private static RuntimeAssembly nLoad(AssemblyName fileName,
String codeBase,
Evidence assemblySecurity,
RuntimeAssembly locationHint,
ref StackCrawlMark stackMark,
#if FEATURE_HOSTED_BINDER
IntPtr pPrivHostBinder,
#endif
bool throwOnFileNotFound,
bool forIntrospection,
bool suppressSecurityChecks)
{
return _nLoad(fileName, codeBase, assemblySecurity, locationHint, ref stackMark,
#if FEATURE_HOSTED_BINDER
pPrivHostBinder,
#endif
throwOnFileNotFound, forIntrospection, suppressSecurityChecks);
}
-
Jul 21st, 2022, 10:55 AM
#2
Re: Why are some function names prefixed with the letter "n"?
There is Load, nLoad and _nLoad functions in the same source file. My guess is n is for new :-))
This is like before source-control everyone had Src, Src Copy, Src Copy (2) and Src_1998_12_01_Final folders in the project root while actually working in Src_1998_12_01_Final Copy (2) :-))
cheers,
</wqw>
-
Jul 21st, 2022, 09:42 PM
#3
Re: Why are some function names prefixed with the letter "n"?
This is just a convention adopted by a developer or team of developers, just like the "cs" and "cis" in your last question. People were able to determine what they meant by read the code that you already had access to, so you should probably spend some more time perusing the code on this occasion. If the code doesn't make it clear, as was the case last time, then all we can do is guess.
-
Jul 23rd, 2022, 09:01 AM
#4
Thread Starter
Frenzied Member
Re: Why are some function names prefixed with the letter "n"?
Originally Posted by wqweto
There is Load, nLoad and _nLoad functions in the same source file. My guess is n is for new :-))
This is like before source-control everyone had Src, Src Copy, Src Copy (2) and Src_1998_12_01_Final folders in the project root while actually working in Src_1998_12_01_Final Copy (2) :-))
cheers,
</wqw>
It's really weird if "n" stands for "new".
-
Jul 23rd, 2022, 09:09 AM
#5
Thread Starter
Frenzied Member
Re: Why are some function names prefixed with the letter "n"?
Originally Posted by jmcilhinney
This is just a convention adopted by a developer or team of developers, just like the "cs" and "cis" in your last question. People were able to determine what they meant by read the code that you already had access to, so you should probably spend some more time perusing the code on this occasion. If the code doesn't make it clear, as was the case last time, then all we can do is guess.
The sample code is from Microsoft's DotNet48ZDP\Source\ndp\clr\src\BCL\system\reflection\assembly.cs.
Even in a giant company like Microsoft, some functions and variables are named very irregularly. Sometimes it's hard to guess what it's supposed to mean.
-
Jul 23rd, 2022, 10:27 AM
#6
Re: Why are some function names prefixed with the letter "n"?
Originally Posted by SearchingDataOnly
Sometimes it's hard to guess what it's supposed to mean.
Sure, but that's what you're asking us to do. If this was some standard naming convention then it would be detailed in Microsoft's style guide. It's not so it's not, so it's some local convention that we won't be able to guess any better than you. If I remember correctly, the relevant code actually specified that the "cs" and "cis" prefixes were used on collections that were case-sensitive and case-insensitive but this method is unlikely to be called in many places so, if there's no comment there that indicates what the prefix means, we can only speculate.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|