Returning a structure without any temporary variable
- From: Xavier Roche <xroche@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 01 Jun 2012 10:14:45 +0200
Hi folks,
Is the following code standard ? (which one ?)
typedef struct my_t {
double d;
unsigned long long l;
} my_t;
void my_t getOne() {
return (my_t) { 1.0 };
}
My feeling is that the code might be correct in C99, but not in C89.
.
- Follow-Ups:
- Re: Returning a structure without any temporary variable
- From: James Kuyper
- Re: Returning a structure without any temporary variable
- From: jacob navia
- Re: Returning a structure without any temporary variable
- From: David RF
- Re: Returning a structure without any temporary variable
- Prev by Date: Re: Aliasing in C99
- Next by Date: Re: typedef struct
- Previous by thread: Another problem (was Re: Error returns and repeated code, GOTOs, etc.)
- Next by thread: Re: Returning a structure without any temporary variable
- Index(es):