Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6387661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:10:47+00:00 2026-05-25T03:10:47+00:00

$ uname -a Darwin Wheelie-Cyberman 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:33:36

  • 0
$ uname -a
Darwin Wheelie-Cyberman 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386

$ g++ --version
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat nolove.cc
#include <iostream>
#include <sstream>

using namespace std;

int main(int argc, char ** argv) {
  unsigned long long i = 0;
  ostringstream o();

  // Compiles fine
  cout << i;

  // Explodes, see below
  o << i;

  return 0;
}

$ g++ -o nolove nolove.cc
nolove.cc: In function ‘int main(int, char**)’:
nolove.cc:14: error: invalid operands of types ‘std::ostringstream ()()’ and ‘long long unsigned int’ to binary ‘operator<<’

I’m somewhat new to C++ (but not to programming or OO design, etc) so I’m assuming I’m just doing it wrong. In practice the unsigned long long above equates to an unsigned 64bit integer on my targeted platforms (above and g++ 4.4.1 on linux 2.6), a different type that amounted to the same thing would also be acceptable (but I haven’t found any.)

Can I use an ostringstream to format this (or similar) type? If not, can I do it without dragging in stdio and snprintf? More philosophically, how does the typing work out that cout can do it, and why wasn’t that functionality extended to the string stream stuff?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:10:48+00:00Added an answer on May 25, 2026 at 3:10 am

    This is becuse this

    ostringstream o(); 
    

    doesn’t declare a variable, but a function returning a stream.

    Try this instead

    ostringstream o; 
    

    See also

    Most vexing parse: why doesn't A a(()); work?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

XML document: <?xml version=1.0 encoding=UTF-8?> <ProcessData> <SOAPAction>urn:echo</SOAPAction> <Content_Type>text/xml;charset=UTF-8</Content_Type> <uname>sarah_brcm</uname> <pwd>BRCM_UVLwNhjrA5fbgqkUNdxQXMfcCDJ</pwd> </ProcessData> XSLT: <?xml version=1.0
Bundler version 1.0.0.beta.2 Rvm Info system: uname: Linux dane-r1f-ubuntu 2.6.32-22-generic #33-Ubuntu SMP Wed Apr
Simply I want to clean older kernel's modules. It's uname -r but I need
$ uname -a Linux crowsnest 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 23:42:43 UTC 2011
i just landed on SunOS: $ uname -a SunOS sunfi95 5.9 Generic_122300-13 sun4u sparc
I wrote following function void validateUser(void) { string uName; string uPassword; char c; map
I have the following table (points): recno uid uname points ============================ 1 a abc
I am attempting to be cheap and execute a local system command ( uname
Is it possible to re-write this query to restart numbering when the UName changes
RUBY_PLATFORM is java either way. Normally I can do system checks with uname but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.