SEARCH YOUR SOLUTION HERE  

standard encoding for float?

Is the encoding for float platform independent That is, if I take
the four bytes, stick them into an ethernet packet send them to
another machine, then (after endian swapping and alignment), set a
float pointer to point at those four bytes, will I get the same
value It seems to work on the plaforms I have, but this is suppose
to work for any machine types -- so I guess my question is, is the
encoding of float standardized

Posted On: Saturday 3rd of November 2012 03:22:10 AM Total Views:  631
View Complete with Replies




Related Messages:

next ISO C++ standard   (280 Views)
Current ISO C++ standard is ISO C++ 1998. Am I correct When is the next standard expected What is the URL for knowing it Will it contain libraries for network programming as part of the standard library .(just as data structures and algorithms were included as part ISO C++ 1998 standard library). Kindly clarify.
#pragma once in ISO standard yet?   (247 Views)
I'm told that "#pragma once" has made it into the ISO standard for either C or C++. I can't find any reference to that anywhere. If it's true, do any of you have a reference I can use
streambuf::overflow -- what does the standard say ?   (300 Views)
I'm working on a basic_streambuf subclass as a frontend for devices which might accept some but, may be not all characters in one go when writing. so device::write(const CharT,std::streamsize 10); might return something between 1...10 indicating that just a portion of the deed buffer has been written. This should be covered within the 'overflow' method of my basic_streambuf subclass. When consulting the IOStream book of Langer & Kreft they only point out that overflow should make some space available within the output buffer. May be even by simply resizing the buffer. However if I look at the fstream_buf implementation of my g++lib (4.1.2) I find that basic_filebuf::close calls 'overflow' in order to write all remaining CharT to the underlying device, which as far as I can see should be a job for 'sync'. And 'overflow' is virtual which one may interprete as an invitation to overwrite it and brake the silent contract between 'overflow' and 'close', that all CharT will happily end up in the file. So -- the question: Is overflow supposed to write the whole buffer, or as L&K state it just tries to make some space available Please no discussion how evil it is to subclass basic_filebuf etc. ;-) Thank you very much indeed.. O. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
Inconsistent template behavior; standard-conforming, UB, or gcc bug?   (335 Views)
Let's assume we have one .cc file which contains the following: // ----------- file 1 ----------- #include template void foo(T t) { bar(t); } void bar(int i) { std::cout
The reuse of keywords in the C++ standard   (269 Views)
Posted here because comp.std.c++ seems to have died an unexpected death. ------- I note with some dismay the proposal to create a new meaning for the C and C++ keyword 'auto', as described in the document N1984 (part of the proposals for C++0X or whatever it's called now). Efforts are being taken to ensure it doesn't conflict with the previous meaning of the keyword, but why not simply have a whole new keyword These aren't stupid, so I assume there must be a good reason. 'Chops -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
What does C++ standard say abot choching constructors?   (280 Views)
In BCB 5.0 the result of the following program #include #pragma hdrstop #include class A {}; class B { public: B() { std::cout
#pragma once in ISO standard yet?   (234 Views)
I'm told that "#pragma once" has made it into the ISO standard for either C or C++. I can't find any reference to that anywhere. If it's true, do any of you have a reference I can use
Creating a menu system with standard C functions   (259 Views)
Hi all! I wrote the following as a test case for a menu based programme: #include #include using namespace std; #define cls system("cls") const int SIZE = 10; int numbers[SIZE]; void list() { cls; cout
c++ standard   (228 Views)
[repost] Is there a c++ standard available free of charge -- wade ward 1108 W. South Jordan pkwy 435 -838-7760 President wade@zaxfuuq.net Westates Companies Merrill Jensen Consulting 1108 W. South Jordan pkwy 42 wade@zaxfuuq.net
Possible to access standard global new operator after it's beenoverridden?   (324 Views)
Is it possible to access the standard global new operator after it's been overridden For instance, I have a situation like this void* operator new( size_t numBytes ) { return sDefaultHeap->ocate( numBytes ); } Heap::Heap( unsigned int memSize ) { // allocate memory for the heap m_memory = new char[ memSize ]; } void InitDefaultHeap( void ) { // this function doesn't currently work because new has been // overridden char* defaultMem = new char[1024]; sDefaultHeap( defaultMem, 1024 ); } The overridden new allocates from the default heap, but the problem is that default heap must be allocated using the standard new operator and not the overridden one. Is this possible My heap class (not the one shown) can take external allocations to take care of the default heap case, but I can't seem to figure out how to make this all work.
Is this standard, or Visual C++ bug ?   (208 Views)
Ok so consider this code : namespace Bar { template T2 f() { return T2(0); } } template void Foo(float y = Bar::f()) { } int main() { Foo(); // C2783: 'T2 Bar::f(void)' : could not deduce template argument for 'T2' return 0; } It does not compile with Visual C++ 2005 and 2008, but G++ has no problem with it. But now, if I remove the template from Foo, it works : namespace Bar { template T2 f() { return T2(0); } }; void Foo(float y = Bar::f()) { } int main() { Foo(); // no problem return 0; } And if f is not in a namespace, it works too : template T2 f() { return T2(0); } template void Foo(float y = f()) { } int main() { Foo(); // no problem return 0; } Any idea Thank you. -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
Template technicality - What does the standard say?   (248 Views)
I've been using Visual C++ 2003 for some time, and recently started working on making my code compile in GCC and MinGW. I hit on lots of unexpected problems which boil down to the same template issue. A noddy mixin layer example should illustrate the issue... class Base { protected: int m_Field; public: Base () : m_Field (0) {} }; template class Derived : public T { public: void Inc () { T::m_Field++; // GCC needs the "T::" here - VC++ doesn't } }; In the above, the idea is to use Derived, but GCC (3.4.5 and 4.1.2) gives error messages even if you never instantiate the template. There are of course examples of similar templates in Stroustrup, but because they are incomplete examples, I can't find one that shows an inherited member being referenced from within the template class. In non-template classes, scope resolution is only needed to access inherited members if there is an ambiguity. There is no ambiguity in the above - the only place m_Field can come from is the inherited class Base via the template parameter T. Following that general principle, I don't see any reason why scope resolution should be needed. What does the standard say about this - should the scope resolution operator be required If it is required, what's the rationale If there's something in Stroustrup about this, can you point me to the right section
TOP 10 graphic card According to standard benchmark 3DMark Software   (239 Views)
TOP 10 graphic card According to standard benchmark 3DMark Software To read more go to http://computerworld4y.blogspot.com
Looking for tutorial C++ source code (standard)   (321 Views)
I have been reading the book "Thinking in C++", and frankly, I am getting sick and tired of the simplistic examples. I am ready to jump head first. Since we are talking generic, textbook type of programs, they will have to be GUI-less. -Ramon ps: Windows-specific code need not apply.
Bad initialization example in standard?   (226 Views)
In 12.6.1 of n2521, it says: "When an aggregate (whether class or array) contains members of class type and is initialized by a brace- enclosed initializer list, each such member is copy-initialized by the corresponding assignment-expression." Then the example is given: complex v[6] = { 1, complex(1,2), complex(), 2 }; where 'complex' is a small class defined in the 12.6 for exemplary purposes. According to the above paragraph, v[1] should be copy-constructed from the temporary complex(1,2). However, the explanation of the example code says: "complex::complex(double,double) is called for the initialization of v[1]". That is, it says that v[1] is directly constructed with arguments 1,2, and no copy constructor is involved. Is the example rationale wrong, or have I misinterpreted the paragraph quoted above
include paths - is there a defacto standard?   (429 Views)
The standard doesn't define this but what conventions do projects use As I understand it, #include is used for including system headers and those of frameworks such as wxWidgets - and #include "someheader.h" is used for more application-specific things. The VC8 docs say, #include searches the paths set for the project, but #include "..." tries the dir of the file with the include, and the file that included it etc... before it searches the project setting include paths. Is this a defacto standard, or do compilers implement different ways of doing it Is there a sort of minimal conventions programmers stick to to be compiler-independent
compiler error (C++ standard compliance issue?)   (307 Views)
The following code fails to compile in any version of C++Builder that I have tried (BCB5, BCB6, BDS2006, CRS2007). According to someone in comp.lang.c++, this same code compiles fine with MSVC7.1, g++ 3.4.4 and Comeau Online 4.3.9. Is this a known bug, or should I report it in QC - Dennis //---------------------------- #include template void strswap(char (&a1)[s], char (&a2)[s]) { for (unsigned i = s; i-- > 0; ) std::swap(a1[i], a2[i]); } class Test { public: char str[10]; void swap( Test &rhs ) { strswap( str, rhs.str ); //
How to tell if standard input is UNICODE or ANSI text ?   (241 Views)
Sorry if asking a known question. I have a program that reads lines of text from standard input and writes the non-empty ones back to standard output. In most cases it will be used with standard input and output streams redirected to FS files. If my input is wide-character (UNICODE) I would like to use wcin and wcout and write wide-character text to standard output. If my input is narrow-character I would like to use cin and cout to write narrow- character text to standard output. How can I tell if my standard input stream has UNICODE text Thank you, Timothy Madden, Romania
The company always pays attention to the quality of its undergarmentsso that they conform to international standards. All these stuffs are madefrom materials of exceptionally softest fabrics. The Button Fly Boxer Brief,Pro Stretch Boxer Brief, 365 Fa   (320 Views)
The company always pays attention to the quality of its undergarments so that they conform to international standards. these stuffs are made from materials of exceptionally softest fabrics. The Button Fly Boxer Brief, Pro Stretch Boxer Brief, 365 Fashion Trunk and 365 Color Trunk are some of its offing that gives you a distinct identity. At the same time, it wont create a heavy financial burden on you, because at 1underwearstore.com, availing these popular stuffs is unbelievably cheap. http://www.replicab2b.net http://www.replicab2b.net/Replica_Wallets_1.html http://www.replicab2b.net/Replica_Jewelrys_1.html http://www.replicab2b.net/Replica_Shoes_1.html http://www.replicab2b.net/Replica_Jeans_1.html http://www.replicab2b.net/Replica_Sunglasses_1.html http://www.replicab2b.net/Replica_Clothing_1.html
standard   (202 Views)
Wade Ward wrote: > Is there a c++ standard available free of charge > No, at least if you're referring to *the* C++ standard. You can purchase a PDF from ISO (ISO 14882:2003), or you can buy dead trees http://www.amazon.com/C%2B%2B-Standa.../dp/0470846747