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 8165315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:30:28+00:00 2026-06-06T19:30:28+00:00

In OpenGL superbible 4th ed, an example on pg 70 reads //returns space-delimited names

  • 0

In OpenGL superbible 4th ed, an example on pg 70 reads

//returns space-delimited names of all extensions supported by the OpenGLDriver
const char *extensions = glGetString(GL_EXTENSIONS);
if(strstr(extensions, "WGL_EXT_swap_control" != NULL))
{
   //...
}

Is this a type-o? Or am I missing an #include? I can’t find an overload for strstr() to support this call. I think it should be

if(strstr(extensions, "WGL_EXT_swap_control") != NULL)
{
  //...
}
  • 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-06-06T19:30:30+00:00Added an answer on June 6, 2026 at 7:30 pm

    Yes, obvious typo. Your code is correct. C does not support overloading.

    The prototype of the function would have to be int strstr(const char *s, int h); for the book’s code to compile, and that doesn’t (as Jonathon Reinhart sort of pointed out) make a lot of sense; how do you look for an integer in a string?

    UPDATE: There’s a lesson here about the quality feel from books whose “example” code obviously won’t compile.

    UPDATE 2: As forsvarir points out, you can get a C compiler to compile this, in which case it will treat the integer resulting from the comparison as a string pointer regardless, and run strstr() using that. Which, on many operating systems, will immediately crash, and which will invoke undefined behavior on all systems.

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

Sidebar

Related Questions

I'm reading OpenGL Superbible 4th ed. In Chapter 2, the example code sets up
In OpenGL superbible the example says I can read Windows specific extensions via: //Type
I'm using opengl and trying to create a first person camera. All examples use
I'm reading OpenGL Superbible 5th ed. I've come across several terms which although explained
I recently started reading OpenGL Superbible 5th edition and noticed the following: Having just
I am learning OpenGL these days, and I tried to compile the example code
Last week I bought an old OpenGL book (OpenGL superbible designed for Windows 95)
When I'm compiling the Triangle project from the opengl superbible 5th ed I've this
I'm looking for sites with examples and tutorials for OpenGL. The OpenGL SuperBible seemed
I just purchased the fifth edition of the OpenGL SuperBible. I'm very pleased that

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.