Click here to Skip to main content
15,179,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
MySql version: 5.1.62
OS: Gentoo Linux

In mysql-5.1.62\mysql-5.1.62\sql-common\client.c, at line 1889

mysql->methods = &client_methods;

It set MYSQL* methods funtion pointer address to static MYSQL_METHODS client_methods array.

My question is why not initialized it in mysql_init just like OOP`s construct.
Posted

1 solution

Actually it is initialized (to 0) in mysql_init.
Why do you prefer 'an earlier' link to the static struct?
   
Comments
Leslie Zhai 2-Aug-12 21:28pm
   
Thank CPanllini, it might be MYSQL mysql static struct object, then mysql_init(&mysql), it is bad 'an earlier' link to static mysql struct object;

But in my situation, MYSQL* mysql = mysql_init(NULL); it my_malloc mysql pointer object, it is suitable to set the funtion pointer address.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900