Series: Subject: Topic:
Question: 50 of 357

What are enumerators? and what are in-line functions? giv ans with eg.

Asked by: vinayakpalande | Member Since Nov-2007 | Asked on: Nov 11th, 2007

View all questions by vinayakpalande

Showing Answers 1 - 2 of 2 Answers

Enum's are data type, while in-line functions are function.enum are integer repesentation in understandable form like-enum {monday,tuesday,......sunday};now if compare likeif( 1== sunday) condition will return functions are the ones which get insert into the code where they are called.The difference between function and in-line function is no call will be made to the in-line function during execution. using this one can improve execution performance. this capability is compiler dependent and also depend on the optimization settings.

Yes  1 User has rated as useful.
Login to rate this answer.

Answered On : Jan 7th, 2008

View all answers by inbox4rakesh

Enumerators: Enumerators are a way to give related constants a human understandable name for better code readability. For example:We can use the following statement to check whether the connection to an SQL Server is open or not with the following statementif(cnConnection.State ==1){  //Code to be executed when the connection is open}However, the following code makes it more readable, if(cnConnection.State ==ConnectionState.Open) {   //Code to be executed when the connection is open }Enumerators are declared in the following way (The syntax may differ from language to language):public enum {name1,name2,name3,...}example:public enum DAYS { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};Inline Functions: Generally, during the execution of a program whenever a call to a function is encountered, the control switches from current execution to the method and vice versa. This impacts the overall performance of code execution. In order to remove this switching, Inline functions are used. It is made possible in the following way:Whenever, the program gets compiled the inline functions get inserted at the calling location so that the execution does not switch in memory locations, and thus improving the program performance.As already mentioned in the previous thread by Kamal, this is a compiler specific option.

Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions



twitter fb Linkedin GPlus RSS


Interview Question

 Ask Interview Question?


Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.