SlideShare a Scribd company logo
1 of 1
Download to read offline
Question #13 Consider a simple class for wrapping a file descriptor. What are the minimal
change(s) that would be required to make the class: 1. hard to accidentally misuse (e.g. causing
an invalid or undesired file descriptor to be closed), and 2. usable as a return value from a
function? 1. Adding a custom move constructor and move assignment operator.
Filedescriptor(filenescriptorss chs) noexcept : fd_(rhs.fd_) f rhs.fd_ =1; i Filedescriptors
operator-(FiloDescriptorss chs) noexcept f using std: :swap; swap(fd, rhs. Fd_); return wthis; 2.
Adding a custom copy constructor and copy assignment operator: Filedescriptor(Filedescrintor
consts rhs) : fd_(rhs.fo_) [) Filedescriptors operator- (FileDoscriptor consts rhs) t fd_- rhs.fd-;
feturn *this; J 3. Disabling the copy constructor and copy assignment operator:
F11eDescriptor(FileDescriptor consts) - delete; Filedescriptars operator-(Filedescriptor consts) -
delete; 4. Disabling the move constructor and move assignment operator:
F11cDescriptor(FiloDescriptorss)=de1ete;F11eDescriptorsoperator-(F11edescriptors8)=delete;
5. Adding default implementations of the move constructor and move assignment operator:
Filedescriptor(Filedescrtptarss) - defau1t; FlieDescriptors operator-(FileDescriptonss) - default;

More Related Content

Similar to Question #13 Consider a simple class for wrapping a file descriptor..pdf

Unix.system.calls
Unix.system.callsUnix.system.calls
Unix.system.callsGRajendra
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdfamitkamble79
 
101 2.3 manage shared libraries
101 2.3 manage shared libraries101 2.3 manage shared libraries
101 2.3 manage shared librariesAcácio Oliveira
 
6 preprocessor macro header
6 preprocessor macro header6 preprocessor macro header
6 preprocessor macro headerhasan Mohammad
 
SECR'13 Lightweight linux shared libraries profiling
SECR'13 Lightweight linux shared libraries profilingSECR'13 Lightweight linux shared libraries profiling
SECR'13 Lightweight linux shared libraries profilingOSLL
 
Programming Embedded linux
Programming Embedded linuxProgramming Embedded linux
Programming Embedded linuxLiran Ben Haim
 
Hadoop Interacting with HDFS
Hadoop Interacting with HDFSHadoop Interacting with HDFS
Hadoop Interacting with HDFSApache Apex
 
Kernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and futureKernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and futureAnne Nicolas
 
2.3 manage shared libraries
2.3 manage shared libraries2.3 manage shared libraries
2.3 manage shared librariesAcácio Oliveira
 
Operating System Laboratory presentation .ppt
Operating System Laboratory presentation .pptOperating System Laboratory presentation .ppt
Operating System Laboratory presentation .pptPDhivyabharathi2
 
LSOF Command Usage on RHEL 7
LSOF Command Usage on RHEL 7LSOF Command Usage on RHEL 7
LSOF Command Usage on RHEL 7VCP Muthukrishna
 
Reproducibility with R
Reproducibility with RReproducibility with R
Reproducibility with RMartin Jung
 

Similar to Question #13 Consider a simple class for wrapping a file descriptor..pdf (20)

Unix.system.calls
Unix.system.callsUnix.system.calls
Unix.system.calls
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
101 2.3 manage shared libraries
101 2.3 manage shared libraries101 2.3 manage shared libraries
101 2.3 manage shared libraries
 
6 preprocessor macro header
6 preprocessor macro header6 preprocessor macro header
6 preprocessor macro header
 
Linux IO
Linux IOLinux IO
Linux IO
 
SECR'13 Lightweight linux shared libraries profiling
SECR'13 Lightweight linux shared libraries profilingSECR'13 Lightweight linux shared libraries profiling
SECR'13 Lightweight linux shared libraries profiling
 
Programming Embedded linux
Programming Embedded linuxProgramming Embedded linux
Programming Embedded linux
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 
Hadoop Interacting with HDFS
Hadoop Interacting with HDFSHadoop Interacting with HDFS
Hadoop Interacting with HDFS
 
Solaris basics
Solaris basicsSolaris basics
Solaris basics
 
Kernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and futureKernel Recipes 2019 - Kernel documentation: past, present, and future
Kernel Recipes 2019 - Kernel documentation: past, present, and future
 
2.3 manage shared libraries
2.3 manage shared libraries2.3 manage shared libraries
2.3 manage shared libraries
 
Operating System Laboratory presentation .ppt
Operating System Laboratory presentation .pptOperating System Laboratory presentation .ppt
Operating System Laboratory presentation .ppt
 
abc12
abc12abc12
abc12
 
popopo
popopopopopo
popopo
 
abc
abcabc
abc
 
C Programming Unit-5
C Programming Unit-5C Programming Unit-5
C Programming Unit-5
 
LSOF Command Usage on RHEL 7
LSOF Command Usage on RHEL 7LSOF Command Usage on RHEL 7
LSOF Command Usage on RHEL 7
 
Reproducibility with R
Reproducibility with RReproducibility with R
Reproducibility with R
 

More from AlphaVision2

Question content area top Part 1 Weights (kg) of poplar trees were o.pdf
Question content area top Part 1 Weights (kg) of poplar trees were o.pdfQuestion content area top Part 1 Weights (kg) of poplar trees were o.pdf
Question content area top Part 1 Weights (kg) of poplar trees were o.pdfAlphaVision2
 
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdfQUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdfAlphaVision2
 
Question-1 (courier Services) As an employee of a large courier and .pdf
Question-1 (courier Services) As an employee of a large courier and .pdfQuestion-1 (courier Services) As an employee of a large courier and .pdf
Question-1 (courier Services) As an employee of a large courier and .pdfAlphaVision2
 
Question Content AreaCost flow is in the reverse order in which co.pdf
Question Content AreaCost flow is in the reverse order in which co.pdfQuestion Content AreaCost flow is in the reverse order in which co.pdf
Question Content AreaCost flow is in the reverse order in which co.pdfAlphaVision2
 
QUESTION TWODescribe the various ecological issues facing project.pdf
QUESTION TWODescribe the various ecological issues facing project.pdfQUESTION TWODescribe the various ecological issues facing project.pdf
QUESTION TWODescribe the various ecological issues facing project.pdfAlphaVision2
 
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdfRecuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdfAlphaVision2
 
Question 6The IT department of a company has just rolled out a vir.pdf
Question 6The IT department of a company has just rolled out a vir.pdfQuestion 6The IT department of a company has just rolled out a vir.pdf
Question 6The IT department of a company has just rolled out a vir.pdfAlphaVision2
 
Receiving a COVID vaccine causes a persons immune system to produce.pdf
Receiving a COVID vaccine causes a persons immune system to produce.pdfReceiving a COVID vaccine causes a persons immune system to produce.pdf
Receiving a COVID vaccine causes a persons immune system to produce.pdfAlphaVision2
 
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdfRecapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdfAlphaVision2
 
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdf
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdfRead two op-eds on the issue of Voter ID. The first op-ed should be .pdf
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdfAlphaVision2
 
Read the Resolving Ethical Business Challenges case at the covering .pdf
Read the Resolving Ethical Business Challenges case at the covering .pdfRead the Resolving Ethical Business Challenges case at the covering .pdf
Read the Resolving Ethical Business Challenges case at the covering .pdfAlphaVision2
 
Read the book of First Corinthians, chapter 12. Among three top reas.pdf
Read the book of First Corinthians, chapter 12. Among three top reas.pdfRead the book of First Corinthians, chapter 12. Among three top reas.pdf
Read the book of First Corinthians, chapter 12. Among three top reas.pdfAlphaVision2
 
Read the attached case on GunnAllens experience with computer secur.pdf
Read the attached case on GunnAllens experience with computer secur.pdfRead the attached case on GunnAllens experience with computer secur.pdf
Read the attached case on GunnAllens experience with computer secur.pdfAlphaVision2
 
Read Case Study below �How Secure Is BYOD� and answer the questions.pdf
Read Case Study below �How Secure Is BYOD� and answer the questions.pdfRead Case Study below �How Secure Is BYOD� and answer the questions.pdf
Read Case Study below �How Secure Is BYOD� and answer the questions.pdfAlphaVision2
 
Rather than being sold on invention, VW realized that sometimes peop.pdf
Rather than being sold on invention, VW realized that sometimes peop.pdfRather than being sold on invention, VW realized that sometimes peop.pdf
Rather than being sold on invention, VW realized that sometimes peop.pdfAlphaVision2
 
Question content area top Part 1 Brett Enterprises had the following.pdf
Question content area top Part 1 Brett Enterprises had the following.pdfQuestion content area top Part 1 Brett Enterprises had the following.pdf
Question content area top Part 1 Brett Enterprises had the following.pdfAlphaVision2
 
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdfRavi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdfAlphaVision2
 
Rate of Return if state occursState of EconomyProbabilitySto.pdf
Rate of Return if state occursState of EconomyProbabilitySto.pdfRate of Return if state occursState of EconomyProbabilitySto.pdf
Rate of Return if state occursState of EconomyProbabilitySto.pdfAlphaVision2
 
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdfRaphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdfAlphaVision2
 
Rank the given minerals in terms of their rate of weathering from fa.pdf
Rank the given minerals in terms of their rate of weathering from fa.pdfRank the given minerals in terms of their rate of weathering from fa.pdf
Rank the given minerals in terms of their rate of weathering from fa.pdfAlphaVision2
 

More from AlphaVision2 (20)

Question content area top Part 1 Weights (kg) of poplar trees were o.pdf
Question content area top Part 1 Weights (kg) of poplar trees were o.pdfQuestion content area top Part 1 Weights (kg) of poplar trees were o.pdf
Question content area top Part 1 Weights (kg) of poplar trees were o.pdf
 
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdfQUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
QUESTION 7 Buffleheads are small diving ducks that primarily eat aqu.pdf
 
Question-1 (courier Services) As an employee of a large courier and .pdf
Question-1 (courier Services) As an employee of a large courier and .pdfQuestion-1 (courier Services) As an employee of a large courier and .pdf
Question-1 (courier Services) As an employee of a large courier and .pdf
 
Question Content AreaCost flow is in the reverse order in which co.pdf
Question Content AreaCost flow is in the reverse order in which co.pdfQuestion Content AreaCost flow is in the reverse order in which co.pdf
Question Content AreaCost flow is in the reverse order in which co.pdf
 
QUESTION TWODescribe the various ecological issues facing project.pdf
QUESTION TWODescribe the various ecological issues facing project.pdfQUESTION TWODescribe the various ecological issues facing project.pdf
QUESTION TWODescribe the various ecological issues facing project.pdf
 
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdfRecuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
Recuerde la Aplicaci�n sobre la propiedad intelectual en las cuentas.pdf
 
Question 6The IT department of a company has just rolled out a vir.pdf
Question 6The IT department of a company has just rolled out a vir.pdfQuestion 6The IT department of a company has just rolled out a vir.pdf
Question 6The IT department of a company has just rolled out a vir.pdf
 
Receiving a COVID vaccine causes a persons immune system to produce.pdf
Receiving a COVID vaccine causes a persons immune system to produce.pdfReceiving a COVID vaccine causes a persons immune system to produce.pdf
Receiving a COVID vaccine causes a persons immune system to produce.pdf
 
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdfRecapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
Recapitulation via hypermorphosisRecapitulation via neoteny WQ3 P.pdf
 
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdf
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdfRead two op-eds on the issue of Voter ID. The first op-ed should be .pdf
Read two op-eds on the issue of Voter ID. The first op-ed should be .pdf
 
Read the Resolving Ethical Business Challenges case at the covering .pdf
Read the Resolving Ethical Business Challenges case at the covering .pdfRead the Resolving Ethical Business Challenges case at the covering .pdf
Read the Resolving Ethical Business Challenges case at the covering .pdf
 
Read the book of First Corinthians, chapter 12. Among three top reas.pdf
Read the book of First Corinthians, chapter 12. Among three top reas.pdfRead the book of First Corinthians, chapter 12. Among three top reas.pdf
Read the book of First Corinthians, chapter 12. Among three top reas.pdf
 
Read the attached case on GunnAllens experience with computer secur.pdf
Read the attached case on GunnAllens experience with computer secur.pdfRead the attached case on GunnAllens experience with computer secur.pdf
Read the attached case on GunnAllens experience with computer secur.pdf
 
Read Case Study below �How Secure Is BYOD� and answer the questions.pdf
Read Case Study below �How Secure Is BYOD� and answer the questions.pdfRead Case Study below �How Secure Is BYOD� and answer the questions.pdf
Read Case Study below �How Secure Is BYOD� and answer the questions.pdf
 
Rather than being sold on invention, VW realized that sometimes peop.pdf
Rather than being sold on invention, VW realized that sometimes peop.pdfRather than being sold on invention, VW realized that sometimes peop.pdf
Rather than being sold on invention, VW realized that sometimes peop.pdf
 
Question content area top Part 1 Brett Enterprises had the following.pdf
Question content area top Part 1 Brett Enterprises had the following.pdfQuestion content area top Part 1 Brett Enterprises had the following.pdf
Question content area top Part 1 Brett Enterprises had the following.pdf
 
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdfRavi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
Ravi es el director ejecutivo de una empresa de revistas. Quiere div.pdf
 
Rate of Return if state occursState of EconomyProbabilitySto.pdf
Rate of Return if state occursState of EconomyProbabilitySto.pdfRate of Return if state occursState of EconomyProbabilitySto.pdf
Rate of Return if state occursState of EconomyProbabilitySto.pdf
 
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdfRaphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
Raphael y Martina est�n comprometidos y planean viajar a Las Vegas.pdf
 
Rank the given minerals in terms of their rate of weathering from fa.pdf
Rank the given minerals in terms of their rate of weathering from fa.pdfRank the given minerals in terms of their rate of weathering from fa.pdf
Rank the given minerals in terms of their rate of weathering from fa.pdf
 

Recently uploaded

INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 

Recently uploaded (20)

INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 

Question #13 Consider a simple class for wrapping a file descriptor..pdf

  • 1. Question #13 Consider a simple class for wrapping a file descriptor. What are the minimal change(s) that would be required to make the class: 1. hard to accidentally misuse (e.g. causing an invalid or undesired file descriptor to be closed), and 2. usable as a return value from a function? 1. Adding a custom move constructor and move assignment operator. Filedescriptor(filenescriptorss chs) noexcept : fd_(rhs.fd_) f rhs.fd_ =1; i Filedescriptors operator-(FiloDescriptorss chs) noexcept f using std: :swap; swap(fd, rhs. Fd_); return wthis; 2. Adding a custom copy constructor and copy assignment operator: Filedescriptor(Filedescrintor consts rhs) : fd_(rhs.fo_) [) Filedescriptors operator- (FileDoscriptor consts rhs) t fd_- rhs.fd-; feturn *this; J 3. Disabling the copy constructor and copy assignment operator: F11eDescriptor(FileDescriptor consts) - delete; Filedescriptars operator-(Filedescriptor consts) - delete; 4. Disabling the move constructor and move assignment operator: F11cDescriptor(FiloDescriptorss)=de1ete;F11eDescriptorsoperator-(F11edescriptors8)=delete; 5. Adding default implementations of the move constructor and move assignment operator: Filedescriptor(Filedescrtptarss) - defau1t; FlieDescriptors operator-(FileDescriptonss) - default;